Decimal Points/Char/Double

Hi Guys.

I am taking a C++ class and am having trouble with a couple aspects of the current program. This program take 10 grades and averages them together and gives you the average percent and letter grade. I have the 10 grades in an array, and average is calculated. Problem the average looks like 0.871.. I need one decimal space and would like it to move over two spaces...

Then I have to give a grade based on the percent, I did if and else statements but it says i can not use a string with a double?

Any help or comments is much appreciated. Thank you.

//make average decimal
double makeDecimal (double average)
{
cout << setprecision(2) << average;

return average;
}
//what is the lettergrade
double makeLettergradeF (double average)
{
string lettergrade;

if (average >90 && average < 79)
lettergrade = 'B';

else if (average < 80 && average > 69)
lettergrade = 'C';

else if (average is <70 && average > 59)
lettergrade = 'D';

else if (average < 60)
lettergrade = 'F';

else lettergrade = 'A';

return lettergrade;
}
if (average >90 && average < 79) I can't see where average is declared or defined :/

use code tags and format your code.
There is more above that is putting numbers into an array and adding them and averaging.. but i got that to compile correctly. :) surprising. there are the two functions that are giving me errors..
Topic archived. No new replies allowed.