I just had to, i modified the code to the only way i know how to repeat a program,
Code:
#include <iostream>
using namespace std;
int main()
{
int percentage, i, x;
x=1;
while(x==1)
{
cout<<endl;
cout<<"Input your test percentage: ";
cin>>percentage;
cin.ignore();
if (percentage<50){
cout<<"You failed. Study harder.\n";
}
else if (percentage<60){
cout<<"You just passed. Study harder.\n";
}
else if (percentage<70){
cout<<"You didn't do very well.\n";
}
else if (percentage<80){
cout<<"You did quite well.\n";
}
else if (percentage<90){
cout<<"You did excellent.\n";
}
else if (percentage<100){
cout<<"You did very well.\n";
}
else if (percentage>100){
cout<<"Who marked your test?\n";
}
else if (percentage==100){
cout<<"You did perfect.\n";
}
cout<<"\n \n \n To try again press 1, or press any key to exit!\n";
cin>>x;
cin.ignore();
}
}
now i am sure there is another more "Clean" way of doing it, if so could anybody please explain?
And would it not be better to use something like
Code:
else if(percentage<90&&percentage>79){
Just askin as thats how i would do it