need to write a program that asks for up to 50 test scores entered on the same line separated by a space and ends when -1 is entered but the scores have to be 0-100 and need to convert to string to not directly read input to test for non numerics entered cant seem to figure this out please help!
constint MAX_SCORE = 50; // the maximum #of scores that a user can enter
int score[MAX_SCORE]; // create storage for up to 50 scores
int nScores = 0; // count the number of scores entered
// read the scores from the keyboard, space and/or newline delimited
cout << "Input up to 50 numbers (0-100) enter -1 after last value input: " << endl;
for (int i = 0; i < MAX_SCORE; i++)
cin >> score[i];
elseif (score[i] < 0)
//proceed as normal
break; // enter no more scores after the 1st negative is found
nScores++; // count the score if it is non-negative
cout << " The number of scores entered was: " << nScores << endl; // say how many scores entered
tried using this but i think i need to convert from string such as atoi function but cant figure out how to separate all the entries to convert to multiple inputs so that the program will count how many test scores are entered?!