Stuck on this assignment...

Im new to C++ and im working on a school assignment but i have no clue what to do next... The next steps in this assignment are:

*If the user enters a value greater than 100, ask the user if they are sure about the grade.
*If they answer y or Y allow the grade. Display any grades greater than 100 as an A+
*If the grade entered is within 0.5 of the next letter grade, ask the user if they want to round the letter grade up.
*If they answer y or Y add 0.5 to the grade before deterring letter grade.


Ive done most of the assignment but dont have a clue how to display the A+...and not sure if i continue doing the samething with IF statements for the 0.5 that will be rounded up...
If someone could give me some pointers I would greatly appreciate it. Thank you


#include <iostream>
using namespace std;

int main()

{
float grade;
char letter;
char yesno;

cout << "Please enter a grade between 0 and 100: ";
cin >> grade;
cout << "Is the grade eligible for extra credit: ";
cin >> yesno;

if (( yesno == 'Y') || ( yesno == 'y'))
{grade += 5;
}
else if (( yesno == 'N') || ( yesno == 'n'))
{

}
else
{
grade -= 10;
}


if ( grade >= 100.01)
{

}
else if ( grade >= 90.0 )
{
letter = 'A';
}
else if ( grade >= 80.0 )
{
letter = 'B';
}
else if ( grade >= 70.0 )
{
letter = 'C';
}
else if ( grade >= 60.0 )
{
letter = 'D';
}
else
{
letter = 'F';
}
cout << "Your Grade is " << letter << '\t' << grade << "\n\n";

system("pause");
return(0);


}
If that code was any longer I'd ask for code tags.
You're going to basically need a ton of nested if statements. Within each grade, you need to check to see if it's 0.5 points within the next grade and ask. There's really no other solution I can conceive.
You cannot display an A+ with a char. That simple. If you plan on doing so you need to switch to icky char[] or std::string.
you can also use switch case for the grade instead of if else.
Last edited on
Topic archived. No new replies allowed.