#include<stdio.h>
void main()
{
int ix,iy;
printf("please input the data of x:");
scanf("%d",&ix);
if(x<-5&&x>0)
printf("the y is :%d",ix);
if(x==0)
{
iy=ix-1;
printf("the y is:%d"&iy);
}
if(x<0&&x<10)
printf("the y is: 1");
printf("input any key to quit!");
gech();
}
這是if的
#include<stdio.h>
void main()
{
int ix,iy,entrance;
printf("input the x:");
scanf("%d",ix);
if(x<-5&&x>0)
entrance=1;
if(x==0)
{
entrance=2;
}
if(x<0&&x<10)
entrance=3;
switch(entrance)
case 1: printf("the y is :%d",ix);break;
case 2: printf("the y is :%d,ix-1");break;
case 3: printf("the y is : 1");break;
printf("input any key to quit!");
getch();
}
就是這個了。