Develop a C++ program to determine a student’s letter grade based on a given integer test score. If the test score is 90 or more, the grade is ‘A’. If the score is between 80 and 89, the grade is ‘B’. If the score is between 70 and 79 the grade is ‘C’. If the score is between 60 and 69 the grade is ‘D’. If the score is less than 60 the grade is ‘F’.
I have this part, but when it comes to printing the name I can't seem to get it. Heres what I have so far. I would like it to print something like: the persons name then the letter grade
#include <iostream>
#include <string>
using namespace std;
int main()
{
//input data
int grade=0;
string name ="";
cout << "Please enter your name: ";
cin >> name;
cout << "Please enter your grade: ";
cin >> grade;
if (grade >= 90)
cout << "Your letter grade is A";
else if (grade >=80)
cout << "Your letter grade is B";
else if (grade >=70)
cout << "Your letter grade is C";
else if (grade >=60)
cout << "Your letter grade is D";
else
cout << "Your letter grade is F" << endl;
return 0;
}