实验 7 综合练习 第三题

#include<stdio.h>
#include<math.h>
int main()
{
    double x,y;

    printf("Enter x:");
    scanf("%lf",&x);
    if(x<-2){
        y=x*x;
    }
    else if(x>2){
        y=sqrt (double(x*x+x+1));
    }
    else{
        y=x+2;
    }
    printf("f(%.2f)=%.2f\n",x,y);

    return 0;
}

 

posted @ 2013-10-31 09:53  傻子疯子捏子  阅读(110)  评论(0编辑  收藏  举报