懂c++的大神帮忙看一下 一个小问题 我这个为什么不对 多谢

2025-05-13 22:45:13
推荐回答(3个)
回答(1):

else 不能直接跟条件 把它改成else if(x<0)或 把(x<0)删掉

回答(2):

2x是数学表示,C++可不支持,你要 写2 *x

回答(3):

#include 
using namespace std;
int main()
{
double x,y;
cin>>x;
if (x>=-0.0000001)
{
y = x+1;
}
else
y = 2*x-3;
cout< system("pause");
return 0;
}