实验 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
",x,y);

    return 0;
}
原文地址:https://www.cnblogs.com/jlg0322/p/3398571.html