#include
using namespace std;
double fun(double x)
{
if (x >= 0)return 2.0*x;
else return x*x+x*3-5;
//if x >= 0; y = 2x
//if x < 0; y = x^2+3x-5;
}
int main()
{
double x;
while (cin >> x){
cout << "y=" << fun(x) << endl;
}
return 0;
}
float x,y;
printf("qingshuru-x/n");
scanf("%f",&x);
if(x>0){
y=2*x;
}else{
y=x*x+3*x-5;
}
printf("y=%f",y);
有一函数: x (-5