帮我看看while括号中应该填什么
如果 错不在那 我应该改哪?
#include<stdio.h>
void displaymenu();
main()
{
displaymenu();
}
void displaymenu()
{
printf("*****************************\n");
printf("* 1.加法 *\n");
printf("* 2.减法 *\n");
printf("* 3.乘法 *\n");
printf("* 4.除法 *\n");
printf("* 5.求余 *\n");
printf("* 6.阶乘 *\n");
printf("* 7.累加 *\n");
printf("* 8.结束 *\n");
printf("*****************************\n");
printf("请选择类型<1,2,3,4,5,6,7,8>?\n");
}
while()
{
menu();
int a=0;
scanf("%d",&a);
switch(a)
{
case 1:
{int i=0,j=0,add=0;
scanf("%d%d",&i,&j);
sum=i+j;
printf("add=%d\n",add);
};break;
case 2:
{int i=0,j=0,sub=0;
scanf("%d%d",&i,&j);
sub=i-j;
printf("sub=%d\n",sub);
};break;
case 3:
{int i=0,j=0,multi=0;
scanf("%d%d",&i,&j);
multi=i*j;
printf("multi=%d\n",multi);
};break;
case 4:
{int i=0,j=0;
float divide=0;
scanf("%d%d",&i,&j);
divide=i/j;
if(j=0)
printf("erro\n");
else
printf("divide=%lf\n",divide);
};break;
case 5:
{int i=0,j=0,arith-compliment=0;
scanf("%d%d",&i,&j);
arith-compliment=i%j;
printf("arith-compliment=%d\n",arith-compliment);
};break;
case 6:
{int i=0;
float fac=1.0;
for(i=1;i<=9;i++)
fac=fac*i;
printf("\n");
printf("fac=%lf",fac);
};break;
case 7:
{int i=0,sum_N=0;
for(i=0;i<=9;i++)
sum_N=sum_N+i;
printf("\n");
printf("sum_N=%d",sum_N);
};break;
}
}
慕的地6264312
慕姐8265434
相关分类