C++ 程序 跳过 输入语句

#include<iostream>usingnamespacestd;classdive{public:voidgetdata();boolcheck();voidca... #include<iostream>

using namespace std;

class dive
{
public:
void getdata();
bool check();
void calculate();
void output();
private:
double judgmentscore[7];
int degree=0;
double totalscore;
};

int main()
{
dive lei;
do{
lei.getdata();
} while (!(lei.check()));
lei.calculate();
lei.output();
system("pause");
return 0;
}

void dive::getdata()
{
cout << "Please enter seven scores(0~10) by judge:" << endl;
for (int inset = 0; inset < 7; inset++)
{
cin >> judgmentscore[inset];
}
cout << "Please enter the degree(1.2~3.8) of difficulty:";
cin >> degree;
return;
}

bool dive::check()
{
bool judge;
for (int inset = 0; inset < 7; inset++)
{
if (judgmentscore[inset]<0 || judgmentscore[inset]>10)
judge = false;
}
if (degree<1.2 || degree>3.8)
judge = false;
return judge;
}

void dive::calculate()
{
int min, max;
double sum = 0;
for (int inset = 1; inset < 7; inset++)
{
if (judgmentscore[inset]>judgmentscore[inset - 1])
max = inset;
if (judgmentscore[inset] < judgmentscore[inset - 1])
min = inset;
}
judgmentscore[max] = judgmentscore[min] = 0;
for (int inset = 0; inset < 7; inset++)
sum += judgmentscore[inset];
totalscore = 0.6*degree*sum;
return;
}

void dive::output()
{
cout << endl << "Total score:" << totalscore << endl;
return;
}
展开
 我来答
zjfaok
推荐于2016-09-25 · TA获得超过6805个赞
知道大有可为答主
回答量:4146
采纳率:62%
帮助的人:1566万
展开全部
让你输七个数,你输十个数,没一直跑到程序最后一行该夸程序设计得好了
追问
我的是1640826352
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式