im trying to make a program that will use a while loop to repeatedly ask a user for a test score. Use a counter to exit the loop when the user has entered 10 test scores. The loop is to figure out the total of all the scores and the highest score. it must use a while loop please explain problems in code
the bottom code is my work done but does not work.
#include <iostream>
using namespace std;
int main() {
int test_score;
int high_score;
int counter = 0;
int target = 10;
while (counter < target){
cout << "Please enter you test score: ";
cin >> test_score;
counter += 1;
}
high_score = test_score[0];
for(int counter=0;counter<10;counter++){
if(test_score[] > high_score){
high_score = test_score[];
}
average = total_score/10;
cout << "The total score is:"<< total_score << endl;
cout << "The highest score is:" << high_score << endl;
cout << "The average is: " << average << endl;
}
Note: Please like the answer. Thank you. Have a nice day.
Get Answers For Free
Most questions answered within 1 hours.