### Appreciate any help with my problem.

I'm quite new to c++ I'm experimenting a little with the CMD console, I'm really not experienced so the structure of my program is terrible, I'm freely open to more efficient ways, so feel free to tell me what I could do to improve it.

I'm trying to modify the program so that it will notify the user of their letter grade: 0-59=F 60-69=D 70-79=C 80-89=B 90-100=A

How would I go about doing this, if I input a score between 0-59 it'll print "you've achieved an F"

 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 #include #include #include #include using namespace std; void z() {Sleep(50);} char x[] = "This is a simple program, which will enable to input your score and recieve the correct grade, depending on what score you input.\n "; int main() { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),10); for(int i = 0; i < 135; i++) { cout << x[i]; z(); } Sleep(2000); cout << " To continue, press ENTER" << endl; cin.get(); system ("CLS"); Sleep(300); string mystr; int scoreA=100; int scoreB=59; int scoreC=69; int scoreD=79; int scoreE=89; int score2; cout << "hello, what is your NAME? " << endl; getline(cin,mystr); cout << "Loading grades......\n\n\n" << endl; Sleep(3000); cout << "input your score, " << mystr << endl; cin >> score2; { if (scoreA==score2) cout << "You've achieved an A+" << endl; } { if (scoreB==score2) cout << "You've achieved an F-" << endl; } { if (scoreE==score2) cout << "You've achieved a B-" << endl; } { if (scoreD==score2) cout << "You've achieved a C-" << endl; } return 0; }
 1234 if (Score >= 0 && Score <= 59) { // Your code. }
try this
 123456789101112131415161718192021222324252627282930313233343536 #include #include using namespace std; string mystr; int main(){ float num; cout<<"enter your name:"; getline(cin,mystr); cout<<"enter your score "<>num; if(num>0 && num<=59) { cout<<"you've achieved F"; } else if(num>=60 && num<=69) { cout<<"you've achieved D"; } else if(num>=70 && num<=79) { cout<<"you've achieved C"; } else if(num>=80 && num<=89) { cout<<"you've achieved B"; } else if(num>=90 && num<=100) { cout<<"you've achieved A"; } }
Thanks a lot, to both of you.

Topic archived. No new replies allowed.