解题思路:
c++入门训练,关键注意fixed和setprecision操作;
注意事项:
参考代码:
#include <iostream> #include <iomanip> using namespace std; int main () { double x,y; cin>>x; if (x<1){ y=x; } else if (x>=1&&x<=10){ y=2*x-1; } else if (x>=10){ y=3*x-11; } cout<<fixed<<setprecision(2)<<y<<endl; return 0; }
0.0分
0 人评分