..for manipulation in the main part of the program.
Basically Im trying to create a Class function that asks the user to enter in 3 different teams and their nationalities and then redisplay them when the main calls that function.
struct squadre {
string teamn;
string nat;
} clube [N_TEAMS];
....
public:
Team(void); //Creates an empty Team
~Team(void);
clube storeTeamName();
Where N_TEAMS = 3
clube Team::storeTeamName()
{
for (n=0; n<N_TEAMS; n++)
{
cout << "Enter Team Name : ";
getline (cin,clube[n].teamn);
cout << "Enter Team Nationality : ";
getline (cin,clube[n].nat);
}
return clube;
and then the main...
Team disp; // defining the class Team
disp.storeTeamName();
cout << "\nYou have entered these teams:\n";
for (n=0; n<N_TEAMS; n++)
{
cout << clube[n].teamn;
cout << " (" << clube[n].nat << " )\n";
}
system("Pause");
I realise Im going to have to assign the disp.storeTeamName() to something so it can mainpulated in the main but Im having trouble working out how Id transfer the object clube of the structure back to the main program. If anyone has any ideas Id be grateful. Sorry If I havent explained myself well enough.
Ive ommitted non relevant elements of the entire program just for ease.