Feb 16, 2016 at 4:19am UTC
[/code]
Last edited on Feb 23, 2016 at 11:14am UTC
Feb 16, 2016 at 5:16am UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout.precision(1);
float input; //we need to store the user input somewhere!
cout << "Grade Converter" << endl;
cout << "---------------" << endl;
cout << "Input grade (60-100): " ;
cin >> input; //get user input;
float converted_grade = (input - 60.f) / 10.0f; //convert value
cout << "Converted grade (0.0 to 4.0): " ;
cout << fixed << converted_grade << endl; // show converted value
return 0;
}
Last edited on Feb 16, 2016 at 6:15am UTC
Feb 16, 2016 at 5:41am UTC
float converted_grade = input * (4.f / 100.f);
Is wrong.
Feb 16, 2016 at 6:06am UTC
Should be
float converted_grade = (input - 60.f) / 10.0f;
Feb 16, 2016 at 11:22am UTC
how did you get
float converted_grade = (input - 60.f) / 10.0f;
Feb 17, 2016 at 9:41am UTC
I just looked at this part of your original post,
Input grade (60-100): 85
Converted grade (0.0 to 4.0):2.5
Some example values are (70 = 1.0, 89 = 2.9, 63 = 0.3, 96 = 3.6).
And thought that was the way the grade was calculated. I don't know if that is though, as we don't use the 4.0 grade system in England, so I am not familar with it.