if else statement in C++
#include <iostream.h>
#include <conio.h>
int main(void)
{ int grade;
//ask the
user for input
cout<<"What's your score: ";
cin>>grade;
if(grade
>= 90)
{ cout<<"A+"; }
else if(grade
>= 80)
{ cout<<"A"; }
else if(grade
>= 70)
{ cout<<"B"; }
else if(grade
>= 60)
{ cout<<"C"; }
else
{ cout<<"Sorry! You got
failed"; }
getch(); //for freez display.
return 0;
}
Comments
Post a Comment