Thursday, July 30, 2009

Calculating letter grade using function in c++?

I am supposed calculate the letter grade using fuction in c++ and I just need some help with writing the actual function. so far, I got this





#include %26lt;iostream.h%26gt;





char getLetterGrade (int gradeIn) {


// replace this comment with your code for this function


} // letterGrade





// insert your code for the getNumericGrade function here








int main() {


int grade;


char letterGrade;





do {


grade = getNumericGrade();


if (grade != -1) {


letterGrade = getLetterGrade(grade);


cout %26lt;%26lt; "The student's letter grade is: " %26lt;%26lt; letterGrade %26lt;%26lt; endl;


}


} while (grade != -1);





cout %26lt;%26lt; "Good-bye" %26lt;%26lt; endl;


return 0;


} // main





can anyone give me any pointers of how to write this function?





Thank you

Calculating letter grade using function in c++?
I hope this isn't your homework, otherwise this is cheating.





Create IF, ELSE IF conditional statements in your function that retun the letter grade





example:


if gradeIn %26gt;= 90 %26amp;%26amp; gradeIn %26lt;=100


return 'A'


else if gradeIn %26gt;= 80 %26amp;%26amp; gradeIn %26lt;90


return 'B'


...


...


else


return 'F'





hope that helps


No comments:

Post a Comment