how to terminate properly display message before terminating
need the program to stop when i input a zero it needs to display you have entered 0 number same goes for negative number (you have entered negative number then stop)
#include<iostream>
usingnamespace std;
int main()
{
int grade, a;
do{
cout<<"Enter Grade: \n";
cin>>grade;
if(grade<=0)
cout<<"You have entered a negative number Please Exit! \n";
return 0;
a++;
if(grade>=90)
cout<<"Your grade is A \n";
elseif(grade>=80)
cout<<"Your grade is B \n";
elseif(grade>=70)
cout<<"Your grade is C \n";
elseif(grade>=60)
cout<<"Your grade is D \n";
elseif(grade<60)
cout<<"Your grade is E \n";
}
while(a != 0);
}
the grade part is ok would really appreciate if someone can help thanks
no exit exits. what i did pauses so they can see the message, then when they hit enter it return's 0 to the system, which terminates the program. you could have also written exit(1) or abort() for the same result