
1个回答
2015-06-01
展开全部
int _tmain(int argc, _TCHAR* argv[])
{
int number = 42; //成员人数
int boy_sth_avg = 4; //男孩平均做事
int girl_sth_avg = 6; //女孩平均做事
int sth = 210; //事件数量
int boy_number = 0; //男孩数量
int girl_number = 0; //女孩数量
do
{
if (sth - boy_sth_avg >= 0)
{
boy_number++;
sth -= boy_sth_avg;
}
if (sth - girl_sth_avg >= 0)
{
girl_number++;
sth -= girl_sth_avg;
}
} while (sth>=4); //平均最小做事情的数量为4
cout << "男孩的数量是" << boy_number << "名" << endl;
cout << "女孩的数量是" << girl_number << "名" << endl;
system("pause");
return 0;
}
代码送你,不多说
{
int number = 42; //成员人数
int boy_sth_avg = 4; //男孩平均做事
int girl_sth_avg = 6; //女孩平均做事
int sth = 210; //事件数量
int boy_number = 0; //男孩数量
int girl_number = 0; //女孩数量
do
{
if (sth - boy_sth_avg >= 0)
{
boy_number++;
sth -= boy_sth_avg;
}
if (sth - girl_sth_avg >= 0)
{
girl_number++;
sth -= girl_sth_avg;
}
} while (sth>=4); //平均最小做事情的数量为4
cout << "男孩的数量是" << boy_number << "名" << endl;
cout << "女孩的数量是" << girl_number << "名" << endl;
system("pause");
return 0;
}
代码送你,不多说
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询