Hello, I am trying to input an unknown amount of numbers (exam scores) and output whether they are passed, failed, or invalid scores. Passed is any score greater or equal to 70, and failed is 69 and below. Invalid scores are out of the range between 0-100.
Sample Input: 77 -45 33 92 105
Sample Output:
***Exam Report***
77 Passed
-45 Invalid Input
33 Failed
92 Passed
105 Invalid Input
here is my code that i am having trouble with:
int grades[30]
cout << "Enter grades: ";
for ( int c = 0; c < n; c++)
cin >> grades[c];
cout << "*** Exam Report***" << endl;
while(cin){
if (grade[c] >= 70)
cout << grade[c] << setw(20) << "Passed" << endl;
else if (grade[c] <=69)
cout << grade[c] << setw(20) << "Failed" << endl;
else
cout << grade[c] << setw(20) << "Invalid exam" << endl;
}
The problem is both my input and output, i cannot figure out how you are able to enter any amount of unknown numbers and then output those numbers in columns like in the sample output/input. Any tips or suggestions?