let me try to understand this better:
1. you have 3 teams with 5 players you need to have averages for each player, each team d total avg. for all teams
the for loop you have need to include a variable to increment the total team score
a variable to calculate the aver of each player each of the 5 times you go through the for loop
2. first for loop will need to be for(team=1,team ,team <=3,team++)
in that for loop will be the for(PLAYER=1,PLAYER<=5,PLAYER++)
and calculate that players average and add the scores to the team score variable.
3. before going to the next team you need to calculate that current teams average
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
for team=1,team<=3,team++)
{
for(i=1; i <=5; ++)
{
count++;
cout<<"Please enter the scores of player <<PLAYER[i]<<":\n";
cin>>score1;
cout<<"Please enter the score of player <<PLAYER[i]<<":\n";
cin>>score2;
cout<<"Please enter the score of player <<PLAYER[i]<<":\n";
cin>>score3;
totalscore =score1+score2+score3;
teamavg=(score1+score2+score3)/3;
score1=0;
score2=0;
score3=0;
}
totalavg=totalscore/15;
}
| |
somewhere in there you will need to print the avgs. out but i think storing the teams scores and players scores in two arrays would be your best bet then you can use use for loops to print out a nice report of the teams avg and players for each team avgs. at the end of the program
i hope this helps you out