#include #include using namespace std; int main () { int score; char grade; cout
ID: 3660457 • Letter: #
Question
#include #include using namespace std; int main () { int score; char grade; cout<<"Function score"<<endl; cout<<"Enter score"<<endl; cin>>score; cout<<"score = "<<score<<endl; if(score>=90) return 'A'; else if(70<=score<=89) return 'B' ; else if(50<=score<=69) return 'C'; else return 'D'; } // I am trying to get the coursegrade by the use of return function. But every time i input the score, i get a incorrect output. I am not getting the char A,B,C,D in the return statement. Please help me i am not able to figure out where the problem is.//Explanation / Answer
You have to use "switch" statement,then u will get correct output
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.