#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
double x, y;
cin >> x;
if (x < 0)
{
y=abs(x+1); //求绝对值
}
else if (x >= 0 && x <= 5)
{
y = 2*x + 1; //注意一定是2*x不能直接写2x
}
else
{
y = sin(x )+ 5; //必须有括号
}
cout << "x=" << fixed << setprecision(2) << x << ",y=" << fixed << setprecision(2) << y;
return 0;
}
12-28
1570
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)