Need suggestion on how to solve this problem.


[/code]
Last edited on
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
float converted_grade = input * (4.f / 100.f);

Is wrong.
float converted_grade = input * (4.f / 100.f);

Is wrong.

What is wrong? I am trying to show how to get user input, process it and output the results.
Should be
float converted_grade = (input - 60.f) / 10.0f;

Should be
float converted_grade = (input - 60.f) / 10.0f;


Fixed it! thanks @Jims

It was suppose to be an example for @bjl311. Its up to him how he wants to implement the details.
thank you both!
how did you get
float converted_grade = (input - 60.f) / 10.0f;
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.
Topic archived. No new replies allowed.