Because there are only three situations, three judgments are enough;
The code is as follows:
Floating x;
float y = 0.0
int k;
Printf ("Please enter a
Because there are only three situations, three judgments are enough;
The code is as follows:
Floating x;
float y = 0.0
int k;
Printf ("Please enter a floating point number! \ n ");
scanf("%f ",& ampx);
if(x & lt; 1)k = 0;
else if(x & gt; = 1。 & ampx & lt 10)k = 1;
else if(x & gt; 10)k = 2;
Switch (k)
{
Case 0: y = x; Break;
Case1:y = 2 * x-1; Break;
Case 2: y = 3 * x-11; Break;
}
printf("y=%f ",y);