Can someone tell me why i get the error code "ISO C++ forbids comparison between pointer and integer" for lines 135 and 149
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//Structure used to store the name, number of the players, and the number of points of each player
struct Players
{
string name; //Name of the player
int numPlayer; //Number of the Player
int numPoints; //Point's scored by Player
};
const int MAXPLAYERS =12;
typedef struct Players Roster[12];
int total;
int maxgoals = 0;
void Greeting ();
void TotalPoints (Roster &Players);
void HighestScore (Roster &Players);
void DisplayAll (Roster &Players);
int main ()
{
Roster SoccerPlayers;
Greeting();
for (int index=0; index< 12; index++)
{
cout << "Enter Player's Name: ";
getline(cin, SoccerPlayers[index].name);
;
do
{
cout << "Enter Player's Uniform Number: ";
cin >> (SoccerPlayers[index].numPlayer);
if (SoccerPlayers[index].numPlayer<=0)
cout << "Zero or negative number not allowed, Try Again" << endl;
}while (SoccerPlayers[index].numPlayer<=0);
do
{
cout << "Enter Player's Points: ";
(cin >> SoccerPlayers[index].numPoints).get();
if (SoccerPlayers[index].numPoints<=0)
cout << "Zero or negative number not allowed, Try Again" << endl;
}while (SoccerPlayers[index].numPoints<=0);
cout << endl;
}
DisplayAll(SoccerPlayers);
TotalPoints(SoccerPlayers);
HighestScore(SoccerPlayers);
return 0;
}
void Greeting ()
{
cout << "___________________________________________________" << endl;
cout << "Welcome to the Soccer Team Data Analyzer" << endl;
cout << "You will now be asked to enter the name" << endl;
cout << "uniform number, and points earned for each player." << endl;
cout << "___________________________________________________" << endl;
}
void DisplayAll (Roster &SoccerPlayers)
{
cout << "Players Score Summary" << endl << endl;
cout << "__________________________________________" <<endl;
cout << "Name Number Score" << endl;
cout << "__________________________________________" << endl;
for (int index=0; index< MAXPLAYERS; index++)
{
cout << setw(20) <<left << SoccerPlayers[index].name;
cout << setw(15) <<left << SoccerPlayers[index].numPlayer;
cout << SoccerPlayers[index].numPoints << endl;
}
}
void TotalPoints (Roster &SoccerPlayers)
{
int TotalScore = 0;
for (int index = 0; index < 2; index++)
{
TotalScore += (SoccerPlayers[index].numPoints);
}
cout << "The total score is: " << TotalScore << endl;
}
void HighestScore (Roster &SoccerPlayers)
{
int firstPlaceIndex;
int secondPlaceIndex;
int max = SoccerPlayers[0].numPoints; // Set the higest to the first persons score
// Loop that runs through and each player and compares one player in the array w/ the one next to them
for( int i = 0; index < 12; i++)
{
// If soceryPlayer's score at index i is greater than
if(SoccerPlayers[i].numPoints > max)
{
firstPlaceIndex = i;
}
cout << "The first place person: " << SoccerPlayers[i].name;
}
// Loop that runs through and each player and compares one player in the array w/ the one next to them
for( int i = 0; index < 12; i++)
{
// If soceryPlayer's score at index i is greater than AND DOES NOT EQUAL FIRST PLACE INDEX
// This way the highest score (1st Place is ignored and it stores the next highest score, which is the second one
if(SoccerPlayers[i].numPoints > max && i != firstPlaceIndex)
{
secondPlaceIndex = i;
}
cout << "The second place person was: " << SoccerPlayers[i].name;
}
}