赞
踩
main()
{
int a[5],b[5],c[5];
flost q[5];
int i;
char d[5];
for(i=0;i<5;i++)
{
a[i]=rand()%100;
b[i]=rand()%100;
c[i]=rand()%4;
if(a[i])
a[i]++;
if(a[i])
a[i]++;
switch(c[i]+1)
{
case 1: d[i]='+';
case 2: d[i]='-';
case 3: d[i]='*';
case 4: d[i]='÷';
}
}
for(i=0;i<5;i++)
{
printf("The %d problem:\n");
printf("%d%c%d=",a[i],d[i],b[i]);
scanf("%d",&q[i]);
system("cls");
printf("The %d problem:\n");
printf("%d%c%d=%d",a[i],d[i],b[i],q[i]);
switch(c[i]+1)
{
case 1:
{
if(a[i]+b[i]==q[i])
printf("yes");
else
printf("not");
}
case 2:
{
if(a[i]-b[i]==q[i])
printf("yes");
else
printf("not");
}
case 3:
{
if(a[i]*b[i]==q[i])
printf("yes");
else
printf("not");
}
case 1:
{
if(a[i]*1.0/b[i]==q[i])
printf("yes");
else
printf("not");
}
}
}
}
解析看不懂?求助智能家教解答查看解答
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。