#include <stdio.h>
void check(double correct_answer[],double answer[],char question[10][100])
{
int i,score=0;
for(i=0;i<10;i++)
if(answer[i]!=correct_answer[i])
printf("第%d题“%s”:答案错误,正确答案应为:%.1Lf\n",i+1,question[i],correct_answer[i]);
else
score+=10;
printf("你的总分为:%d\n",score);
}
void main()
{
char question[10][100]={"2x+3=0,求x?","x*x-4x+4=0,求x?","11*11=?","直角边为根号7的等腰三角形面积是?","sin30=?","对x从2积分到3为?","5!=?","六个人排队,组合有几种?","二进制100转化为十进制是?","1+1=?"};
double correct_answer[10]={-1.5,2,121,3.5,0.5,2.5,120,720,4,2};
double answer[10]={0};
int i;
puts("开始答题:");
for(i=0;i<10;i++)
{
printf("第%d题:\t",i+1);
puts(question[i]);
scanf("%lf",&answer[i]);
}
check(correct_answer,answer,question);
}
温馨提示:答案为网友推荐,仅供参考