c程序设计题,求大佬帮忙
x,y分别是男生女生的里程,xtime和ytime分别是跑步时间随计数i递增,男生休息时xtime停止递增,ytime正常递增,女生在男生休息时追上男生。
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
float x,y;
int xtime=0, ytime=0;
for (int i = 1; i < 10000; i++)
{
xtime ++;
ytime ++;
x = 2.3*xtime;
y = 0.9*ytime;
if (i % 30 == 0)
{
if (x > y) //男生休息时xtime停止递增,ytime正常增加
{
for (int j = 1; j <= i / 30 * 5; j++, i++)
{
ytime++;
x = 2.3*xtime;
y = 0.9*ytime;
if (x < y) //男生休息时,女生开始展开追逐直至超越
{
cout << i << "秒女生超过男生" << endl;
cout << "男生跑了" << x << "米" << endl;
cout << "女生跑了" << y << "米" << endl;
system("pause");
return 0;
}
}
}
}
}
system("pause");
return 0;
}