头都想破了,麻烦高手指点一下。
/*创建学生出题程序,要求输入题数自动生成题目(10以内加减法)并显示正确与错误,计算正确率和得分。*/?baifenbi(float x,float y)
{
float z;
z=(x/(x+y));
return(z);
}
main()
{
int a,b,c,d;
float e=0.0,f=0.0,g;
printf("chu ti dao shu wei:");
scanf("%d",&b);
c=b+2;
for(a=1;a<=10&&a<=b;a++)
{if(b>=5)
{c=c-1;
printf("%d+%d=\n",a+1,c-1);
printf("da an shi:\n");
scanf("%d",&d);
if(d==(a+1+c-1))
{
e++;
printf("%d is right\n",a);
}
else
{
f++;
printf("%d is wrong\n",a);
}
}
if(b>0&&b<5)
{c=c+1;
printf("%d+%d=\n",a+1,c+2);
printf("da an shi:\n");
scanf("%d",&d);
if(d==(a+1+c+2))
printf("%d is right\n",a);
else
printf("%d is wrong\n",a);
}
}
g=baifenbi(e,f);
printf("zhen que lv shi %5.2f",g);
getch();
}