# Why can't I get my code to print the correct letter grade for my test scores

 Number Double07 · May 17, 2015 I want my code to print letter grades for my test scores from three exams, quiz, midterm, and a final.  An A is 90 and above, B is 70 to 89.9999999, C is 50 to 69.999999, the rest is failing.  To summarize what I have done, I created two functions, one to calculate the average of the test scores, and the other to give a letter grade corresponding to that average.  However, my letter grade keeps giving me the @ symbol.  I've been stuck on this for 35 minutes now.  ``#include using namespace std;float finalScore (int x, int y, int z);char letterGrade (float x);float finalScore (int x, int y, int z){   float average;   float total_score = static_cast (x+y+z);   float tests = 3;   average = total_score/ tests;   return average;}char letterGrade (float x){   char Grade;   if (x >= 90)       char Grade = 'A';   else if (x >= 70 && x < 90)       char Grade = 'B';   else if (x >= 50 && x < 70)       char Grade = 'C';   else       char Grade = 'F';   return Grade;}int main(){/*2. Write a program that determines a student’s grade.The program will read three types of scores (quiz, mid-term, and final scores)and determine the grade based on the following rules:-if the average score =90% =>grade=A-if the average score >= 70% and  grade=B-if the average score>=50% and grade=C-if the average scoregrade=F*/int nquiz;int nmid_term;int nfinal;float faverage;char Grade;cout  nquiz;cout  nmid_term;cout  nfinal;faverage = finalScore(nquiz, nmid_term, nfinal);cout ``

## Replies

- page 2

 sumeet prasad · May 18, 2015 the main reason why  your program gives you the error is because you are not supplying any value ...hint use cin >>to enter input.
• 1
• 2

## C++

129,752 followers