I am trying to finish this program that is due tonight. I have been working on it through out the week and thought I could figure out my errors with fresh eyes. I have got the number of errors down, but for some reason I keep getting errors like string is undeclared in line 12 or playerNameAr undeclared. There seems to be a lot of undeclared identifier and I can't figure out why.

/* Programming Assignment: LAB1B
    Developer: Marcia Huggins
    Date Written: January 2, 2011
    Purpose: Video Game Player Program
    */

#include <iostream>
#include <iomanip>
#include <string>

const int ARRAY_SIZE = 100;
void InputData(string[], int[], int &);
void DisplayPlayerData(const string[], const int[], int);
double CalculateAverageScore(const int[], int);
void DisplayBelowAverage( const string[], const int[], int, double);

void main()
{
    //Declare the player name and score arrays, number of players, and average score.
    string playerNameAr[ARRAY_SIZE];
    int scoreAr[ARRAY_SIZE];
    int numPlayers = 0;
    double averageScore;

    cout << fixed << showpoint << setprecision(2);

   //Call the InputData function
    InputData(playerNameAr, scoreAr, numPlayersAr);
   //Call the DisplayPlayerData function
    DisplayPlayerData(playerNameAr, scoreAr, numPlayers);
   //Call the CalculateAverageScore function and assign the returned value in average score
    CalculateAverageScore(scoreAr, numPlayers);
   //Call the DisplayBelowAverage function
    DisplayBelowAverage(playerNameAr, scoreAr, numPlayers, averageScore);

}
void InputData(playerNameAr[], scoreAr[], numPlayersRef)
{
    while(numPlayersRef < ARRAY_SIZE)
    {
        //Prompt for the player's name or Q to quit
        cout << "Enter the player's name (Q to quit). " << endl;
        getline (cin, playerNameAr[numPlayersRef]);
            if (playerNameAr[numPlayersRef] == "Q") break;
        //Prompt the user for the player's score
        cout << "Enter the player's score. " << endl;
        cin >> scoreAr[i];
        //Add 1 to the number of players    
        numPlayersRef++;
    }
}
void DisplayPlayerData(playerNameAr[], scoreAr[], numPlayers)
{
    cout << setw(10) << left << "\n  Name" 
            << setw(5) << right << "Score" << endl;
    for(int i = 0; i < numPlayers; i++)
    {   
        //Display the name and score of each player
        cout << "The players name is: " << playerNameAr[i] << endl;
        cout << "The players score is: " << scoreAr[i] << endl;
        i++;
    }
} 
double CalculateAverageScore(scoreAr[], numPlayers)
{
    int i;
    double averageScore, totalScore;

    for(i = 0, totalScore = 0; i < numPlayers; i++)
    {
        //Add up the scores 
        totalScore += scoreAr[i];
    }
        //divide by the number of scores to calculate the average score
        averageScore = totalScore / numPlayers;
        //Display the average score
        cout << "Average score is ." << averageScore << endl;
        //Return the average score to main
        return averageScore;


}
void DisplayBelowAverage(playerNameAr[], scoreAr[], numPlayers, averageScore)
{
    cout << "Players who scored below average\n";
    cout << setw(10) << left << "  Name" << setw(5) << right << "Score" << endl;
    for(int i = 0; i < numPlayers; i++)
        if(scoreAr[i] < averageScore)
        //Display the names and scores of all players who scored below the average score
        cout << setw(10) << left << playerNameAr[i] << setw(5) << right << scoreAr[i] << endl;
}

Never mind figured out my stupid mistake.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.