题目是y=3x(-6<=x<0)
y=2x-6(x==0)
y=x+2(0<x>=6)
#include<stdio.h>
main()
{
double x,y;
int p;
scanf("%lf",&x);
if(x>6||x<-6)
printf("no");
else if(x<0)
p=1;
else if(x>0)
p=2;
else if(x==0)
p=3;
switch(p)
{
case '1':printf("%f",y=3*x);break;
case '2':printf("%f",y=x+2);break;
case '3':printf("%f",y=x+2);break;
}
}