小编Mat*_*ler的帖子

用C++计算两个不同的平均值

我的任务是计算保龄球平均值.我有五名球员,每位球员有三场比赛.我目前有两个循环运行,一个用于播放器,另一个用于游戏号码.我需要在每个循环结束时显示玩家平均值,并且团队在该循环结束时平均.

我修复了我的代码,并用下面的新代码替换了我的旧代码.在我查看每个人的评论等之前,我正在玩它,然后我解决了它.

但是谢谢大家!

#include <iostream>

using namespace std;

int main()
{
//DECLARATIONS
const int PLAYER_NUMBER = 5; //There are five players total
const int GAME_NUMBER = 3; //There are three games total
const int MIN = 0; //Min number
const int MAX = 300; //Max number
double* playerScore; //The players' score of current game
double playerAverage = 0; //The current players' average
double teamAverage = 0; //The teams' average

//INPUT

for (int currentPlayer = 0; currentPlayer < PLAYER_NUMBER; currentPlayer++)
{//Set …
Run Code Online (Sandbox Code Playgroud)

c++ average dev-c++

2
推荐指数
1
解决办法
854
查看次数

标签 统计

average ×1

c++ ×1

dev-c++ ×1