Thanks for pointing that out, I thought that because arrays start at 0 that x would have to be 99, and I thought we had to declare the total number of spaces in the beginning.
#include <iostream>
#include <iomanip>
#include <string>
usingnamespace std;
//main function
int main()
{
string name[100]; //Array for name entries
double score[100] = { 0 }; //Array for the scores
double avgScr = 0; //score average
int x = 0;
int totalPlayers = 0; //total number of players
displayData(name[], score[]); //call to function:: Errors here are about expecting an expression.
}
//Input and Display name and score
void displayData(string name[], double score[], int x)
{
for (int x = 0; x <= 99; x++)
{
cout << "Player name (Q to quit): "; //name
cin >> name[x];
//Quit Options
switch (name[x]) //Error here must have integral or enum type
{
case'Q': break; //Errors here have char type instead of string
case'q': break;
default:
cout << "\nPlayer Score: ";
cin >> score[x];
}
}
}
Yes, just be aware though that as a parameter or return type, double score[] will degrade to double *score. It's a weird carry-over from C, but it does what you want.