- #1
VinceStolen
- 9
- 0
Hi I am writing a code and I am getting a compiler error that I can not seem to figure out. I have limited programming knowledge and I have come here for help. This is the section of code I feel is relevant.
struct Player {
string name;
int goals;
int assists;
};
int find_player(Player , int , string);
void print_player( const Player &);
int main() {
Player p[50]
int size = 0;
string find;
cout << endl; << "Please enter players name: "
cin >> find;
if (find_player(p, size, find) == (-1)) {
cout << "No such player exists";
}
else {
print_player(p[find_player(p, size, find)]);
}
return 0;
}
void print_player(const Player &p) (//not important)
int find_player( Player p[ ], int size, string x) {
for (i=0, i < size, i++) {
if (p.name == x)
return i;
else
return (-1);
}
struct Player {
string name;
int goals;
int assists;
};
int find_player(Player , int , string);
void print_player( const Player &);
int main() {
Player p[50]
int size = 0;
string find;
cout << endl; << "Please enter players name: "
cin >> find;
if (find_player(p, size, find) == (-1)) {
cout << "No such player exists";
}
else {
print_player(p[find_player(p, size, find)]);
}
return 0;
}
void print_player(const Player &p) (//not important)
int find_player( Player p[ ], int size, string x) {
for (i=0, i < size, i++) {
if (p.name == x)
return i;
else
return (-1);
}
Last edited: