So I've been working on this project for quite awhile now and I can't seem to figure out how to fix all of my errors. If you could run the program, it will appear as 17 errors. So far I don't know where I could of went wrong. Any help would be appreciated even if its just suggestions/advice.
** NO Global Variables was the only thing prohibited **
Please note this code below was my rough draft, after I get all the functions to work and whatever else I will fix the cosmetic parts and will use precision code for the right amount of spaces when consoled out.
/* Developer: DaniwebOS
Date Written: January 6, 2011
Purpose: Video Game Player Program
*/
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
//All Prototypes
void InputaData(string[], int[], int, int);
void DisplayPlayerData(string[], int[], int);
double calAVGScore(int[], int);
void AvgBelowPlayerData(string[], int[], int, double);
//Main Function
int main()
{
//Local Variable used
const int SIZE = 100;
int numPlayers = 0;
double avgScore;
//---
string playerName[SIZE];
int score[SIZE];
InputData(playerName, score, addNumPlayers, SIZE);
DisplayPlayerData(playerName, score, numPlayers);
calAVGScore(score, numPlayers);
AvgBelowPlayerData(playerName, score, numPlayers, avgScore);
getch();
return 0;
}
//Data will be inputed in the function below
void InputData(string playerName[], int score[], int addNumPlayers, int SIZE)
{
while (addNumPlayers<SIZE)
{
cout << "Enter Player Name (Q to Quit): ";
cin >> playerName[addNumPlayers];
if ((playerName == 'Q') || (playerName == 'q'))
{
break;
}
cout << "Enter score for " << playerName << ": ";
cin >> score[i];
//count
addNumPlayers++;
}
}
//Overall Data to be displayed
void DisplayPlayerData(string playerName[], int score[], int numPlayers)
{
cout << "Name" << " " << "Score" << endl;
for (int i=0; i<=numPlayers; i++)
{
cout << playerName << score << endl;
//i++??????****????
}
}
//Overall average score
double calAVGScore(int score[], int numPlayers)
{
int i;
double avgScore, totalScore;
for(int i=0, totalScore = 0; i < numPlayers; i++)
{
//accumulate
totalScore += score[i];
}
avgScore = totalScore/numPlayers;
cout << "Average score is " << avgScore << endl;
return avgScore;
}
//Individuals below avg score to be displayed
void AvgBelowPlayerData(string playerName[], int score[], int numPlayers, avgScore)
{
cout << "Players who scored below average" << endl;
cout << "Name" << " " << "Score" << endl;
for (int i=0; i <numPlayers; i++)
{
if (score[i] < avgScore)
cout << playerName[i] << score[i] endl;
}
}