I'm not sure what I'm doing wrong. I need this for an assignment.. can someone please tell me what this error means and what I need to do to correct this? Thanks! I'm trying!
1>.\lab5a.cpp(38) : error C2448: 'Inputdata' : function-style initializer appears to be a function definition
Code:// To take in information of players and scores in a string array // to display averages of players ranged to 100 and display averages and below averages #include <iostream> #include <string> #include <iomanip> using namespace std; // declare variables const int ARRAY = 100; string name [ARRAY]; int score [ARRAY]; int sum = 0; int i = 0; int totalscores = 0; double average; //prototypes int Inputdata(); void DisplayPlayerData(); int CaculateAverageScore(); int DisplayBelowAverage(); int main() { Inputdata(); DisplayPlayerData(); CaculateAverageScore(); DisplayBelowAverage(); return 0; } int Inputdata(name[i], score[i], sum, totalscores) { do { cout << "Please enter player name: "; getline (cin, name[i]); cout << "Please Enter Player Score: "; cin >> score[i]; sum = sum + score[i]; i++; totalscores = i; } while( name[i] != "Q" || i < ARRAY); return sum, totalscores; } void DisplayPlayerData() { i = totalscores; do { cout << "You entered: " << name[i], score[i]; i--; } while(i > -1); } int CalculateAverageScore() { double average = sum/totalscores; cout << "The average score of the players are : "; return average; }



LinkBack URL
About LinkBacks



