解题思路:
用f()分段;
参考代码:
#include<iostream>
using namespace std;
#include <iomanip> //用来输出小数位数
int main()
{
float x,y;
cin>>x;
if(x<1)
cout<<fixed<<setprecision(2)<<x<<endl;
else if(x>=1&&x<10)
cout<<fixed<<setprecision(2)<<2*x-1<<endl;
else
cout<<fixed<<setprecision(2)<<3*x-11<<endl;
return 0;
}
0.0分
2 人评分