I am trying to write a stop command if the number of test is 0. I tried a if else statement and it doesn't print the statement and end the program, it tries to calculate 0 tests.
int main()
{
int number; //number of tests
int countNumber; //couter of test scores
float test; //test scores
float totalTest; //Total of test scores
float testAve; //Test average
// Get the total number of tests.
cout<<"Enter the total number of tests taken: ";
cin>>number;
countNumber=0;
totalTest=0;
while (number>countNumber)
{
cout<<"Test score: ";
cin>>test;
totalTest=totalTest+test;
cout<<"The total of the test scores are: "<<totalTest<<endl;
countNumber=countNumber+1;
testAve=totalTest/countNumber;
}
cout<<"The average test score is: "<<testAve<<endl;
system ("pause");
return 0;
}