You got it pretty close, but there's an easy way you can bypass your 100# limit. Also, if you're going to limit the count of players to 100, you need to let the user know that. If your user had typed in 101 (a valid option in your code), the app would've thrown an exception later on while assigning values to your array.
NOTE: I did not change this in an IDE or compile it, so there might be a minor bug or two, but the concept is the same. BTW, coding in a reply box blows balls.
Code:
#include <iostream>
using namespace std;
int main()
{
int amountofplayers = 0;
int newVal = 0;
int sum = 0;
int average = 0;
cout << "How many players do you have?" << endl;
cin >> amountofplayers;
for(int x = 0; x < amountofplayers; x++)
{
// You probably haven't learned switch statements yet, but you'll noticed how it easily resolves multiple IF cases into one.
// They generally make your code look cleaner and more professional (read: more maintainable). Also, only one IF case need to be tested here.
// 4 If-statements won't eat almost any CPU cycles, but get "optimization" into your head now and you'll be a happy camper in the future.
switch ( x )
{
case 0:
cout << "What was the 1st person's score?" << endl;
break; // Break tells the code to not process the next case as well. Removing these can be used in a cascading effect which may or may not be desirable.
case 1:
cout << "What was the 2nd person's score?" << endl;
break;
case 2:
cout << "What was the 3rd person's score?" << endl;
break;
default:
cout << "What was the " << x + 1 << "th person's score?" << endl;
break;
}
cin >> newVal; // I'm sure there's a way to combine this line and the next into one, but for the sake of simplicity...
sum += newVal; // += is a binary operator that means add the following value (newVal) to the preceding (sum).
// This will get rid of your limited array, as well as the need for a for-loop later on.
}
// Getting rid of the loop you had here is important. Not in this case, per say, but in more complex apps, additional loops just eat CPU cycles and memory.
cout << "The average of your scores is about: " << sum / amountofplayers << endl;
return 0;
}