I just want modify the program below to print + or - minus after the letter grade based on the last digit.

``````// Chapter 6 - Exercise 1
//             A professor generates letter grades using
/*             0 -  60 F
67 -  70 D
71 -  80 C
81 -  90 B
91 - 100 A
*/
#include <iostream>

int main()
{
std::cout << "Enter the grade #: ";

if (grade <= 60)
{
}

if ((grade >=61) && (grade <= 70))
{
}

if ( (grade >= 71) && (grade <= 80))
{
}

if ( (grade >= 81) && (grade <= 90))
{
}

if ( grade >= 91)
{
}

std::cout << "The letter grade is " << letter_grade << "\n";

std::cin.get();
return 0;
}``````
3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by SgtMe

I just want modify the program below to print + or - minus after the letter grade based on the last digit.

``````// Chapter 6 - Exercise 1
//             A professor generates letter grades using
/*             0 -  60 F
67 -  70 D
71 -  80 C
81 -  90 B
91 - 100 A
*/
#include <iostream>

int main()
{
std::cout << "Enter the grade #: ";

if (grade <= 60)
{
}

if ((grade >=61) && (grade <= 70))
{
}

if ( (grade >= 71) && (grade <= 80))
{
}

if ( (grade >= 81) && (grade <= 90))
{
}

if ( grade >= 91)
{
}

std::cout << "The letter grade is " << letter_grade << "\n";

std::cin.get();
return 0;
}``````

You want to add + or - depending on the last digit of the grade? I didn't quite catch your purpose...

Yes, and i'll try to make my writing more clear.(note to self read over before posting :D)

Edited by Ace1.0.1.: n/a

That would be very difficult seeing as you have varied boundaries between grades. An easy way round it would be laying out percentage boundaries for each grade. Ie:

``````A* = 90%
A+ = 88%
A  = 86%
A- = 83%
B+ = 80%
etc.``````

Then calculate a percentage and work out which grade they got. This would take rounding because you most likely will end up with dividing to make a decimal, though you would have a lot of if statements. There's probably an easier way to do it that I haven't thought of...

Is this thread solved? If so, please mark as. Thanks :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.