/*We'll make an array of size 20This means the user can enter a maximum of 20 test scores beforethe array runs out of spaceIt's important to note that the subscript of an array actuallystarts at 0, so an array of size 20 goes from ArrayName[0] toArrayName[19] (20 elements)*/int test[20];int choice = 0; /*number of test scores to enter, shouldn't be greater than array size*/int i = 0;cout << "Enter number of test";cin >> choice;/*Next, you'll have to use a loop to run through the code a certain number of times*/while(i < choice){cout << "Please enter the test scores";cin >> test[i];++i; //increase i by 1 every loop}
It's important to note than you can only enter one test score
at a time with this method and it will display "Please enter the
test scores" each loop. You'll also have to modify the rest of
your code to read from an array instead of a normal variable.
Hopefully this helps.
[edited by - suikio on October 17, 2003 8:00:04 PM]