代码如下:(好兄弟,要自己写呀,多看语法,别偷懒,后面会吃亏的,推荐C语言入门书籍)(使用DevC++编写)
#include<stdio.h>
#include<cmath>
int main()
{
float x;
scanf("%f",&x);
if(x<0){
float y=fabs(x);
printf("%lf",y);
}
else if(0<=x && x<2){
float y=sqrt(x+1);
printf("%lf",y);
}
else if(2<=x && x<4){
float y=pow(x+2,3);
printf("%lf",y);
}
else if(x>=4){
float y=x*2+5;
printf("%lf",y);
}
else{
printf("Error ,Input again!");
}
}