一问题及代码
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double x,y;
cin>>x;
if(x<2)
cout<<"y="<<x<<endl;
else if(x<6)
cout<<"y="<<x*x+1<<endl;
else if(x<10)
cout<<"y="<<sqrt(x+1)<<endl;
else
cout<<"y="<<1/(x+1)<<endl;
while (1);
return 0;
}
二运行结果