如题,找不到错在哪了,求指点QAQ
以下是我的代码:
#include<iostream>
using namespace std;
int main() {
double s, x;
double speed = 7;
cin >> s >> x;
int d = 0;
while (d < s + x) {
d += speed;
if (d >= s - x && d + speed * 0.98 > s + x) {
cout << "n" << endl;
break;
}
else if (d >= s - x && d + speed * 0.98 <= s + x) {
cout << "y" << endl;
break;
}
speed *= 0.98;
}
return 0;
}