Error 2 error C2228: left of '.set_team_name' must have class/struct/union c:\users\joe mcdermott\desktop\programing resit work\amateur football league\amateur football league\amateur football league.cpp 20 Amateur Football League
oh wait.. that's a char. Nevermind what I wrote before.
You're trying to call "set_team_name" from your teamlist object, but teamlist is a char array, and char arrays do not have member functions. if "teamlist" is really meant to be the name of the team, you should:
1) rename it to it makes more sense. It's not a team list if it's the name of the team, then it's the team name. So change it to "name" or something else more suitable
2) make it a std::string. You still seem to be struggling with some very basic C++ concepts, so you shouldn't confuse yourself with the added difficulty of char arrays.
3) don't call 'set_team_name' on a char array or a string. If you have a string, just assign it:
1 2 3 4 5 6 7 8 9 10
class cteams
{
public:
string name;
void set_team_name(string& team_name)
{
name = team_name;
}
};
Sorry about that, ignore that. I didn't realize it was a char array -- I thought you were accessing an array of objects. Nevermind what I said before -- see my edit.