代码文本:
#include "stdio.h"
#include "math.h"
int main(int argc,char *argv[]){
double x,y,e=2.718281828459;
printf("Enter x(R:)...\n");
scanf("%lf",&x);
if(x<-2.0)
y=sin(x+x)-5;
else if(x>=-2 && x<5.0)
y=sqrt(x+5);
else if(x>=5.0 && x<10.0)
y=pow(e,x+x)/(x+2.0);
else
y=-x*x+4.0;
printf("y(%.2f)≈%.2f\n",x,y);
return 0;
}