#include
//精度输出 分段函数
#include
using namespace std;
int main() {
double x,y = 0;
cin>>x;
if(x>2&&x<=10) {
y=x*(x+2);
cout<<fixed<<setprecision(6)<<y;
} else if(x>-1&&x<=2) {
y=2*x;
cout<<fixed<<setprecision(6)<<y;
} else if(x<=-1) {
y=x-1;
cout<<fixed<<setprecision(6)<<y;
}
return 0;
}
C++ iomanip库的对数据精度输出的用法
最新推荐文章于 2024-04-10 17:13:45 发布