测试小学生算术成绩的程序
1. 出十条加减乘的算术题
2. 题目不同
3. 待被测人给出答案后判断正确与否
4. 最终给出分数
5. 具有重复测试功能
因时间仓促,结果就草草了之,所以虽然程序完成了,也存在许多问题而显的程序很不完美。
希望别介意。程序经调试,能运行!
源程序:
main()
{ loop:{int i,j=0,mark,a[10],b[10];
printf("*******1:10+2=********\n");
b[0]=10+2;
printf("*******2:15+3=********\n");
b[1]=15+3;
printf("*******3:20+1=********\n");
b[2]=20+1;
printf("*******4:20-1=********\n");
b[3]=20-1;
printf("*******5:44-20=*******\n");
b[4]=44-20;
printf("*******6:2*16=********\n");
b[5]=2*16;
printf("*******7:12+12=*******\n");
b[6]=12+12;
printf("*******8:13*3=********\n");
b[7]=13*3;
printf("*******9:6*23=********\n");
b[8]=6*23;
printf("*******10:4*8=********\n");
b[9]=4*8;
printf("please input the answers to these practice:\n");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
for(i=0;i<10;i++)
{if(a[i]==b[i])
j++;
else
printf("the %dth answer was wrong!\n",i+1);
}
mark=j*10;
if(mark>80)
printf("congratuations! \nyou get %d for the test!\n",mark);
else if(mark>60&&mark<80)
printf("you have got %d and passed the test!\n",mark);
else
printf("sorry!you only get %d and haven't passed!\n",mark);
}
goto loop;
}