我需要为保龄球游戏编写一个程序。要求用户输入游戏数和投球手数。对于每个投球手,获得每场比赛的得分。显示分数。计算每个投球手的平均值并显示平均值。最后显示球队平均水平。我写了一个代码,它没有错误,但问题是它不计算球员的平均得分和球队的总得分。在这些计算方面需要帮助。
#include <stdio.h>
int main()
{
int playerTotal = 0;
int teamTotal = 0;
int score;
int numgames, player, bowler, game;
printf ("How many games?\n");
scanf ("%d", &numgames);
printf ("How many players?\n");
scanf ("%d", &player);
for (bowler = 1; bowler <= 3; bowler++)
{
for (game = 1; game <= 2; game++)
{
printf ("\nEnter the score for game %d for bowler %d: ", game, bowler);
scanf ("%d", &score);
playerTotal += score;
}
printf ("\nThe average for bowler %d is: ", bowler, playerTotal/2);
printf ("\nThe total for the game is:", teamTotal);
teamTotal += playerTotal;
}
return 0;
}