题目描述
利用C语言编写一个小学生考试系统,能够实现加减乘除随机题目生成,以及从文件中加载题目。学生答完题目后,程序能够进行对错判断以及正确率计算。
源代码
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
//定义习题结构
struct test{
char text;
char texts[50];
int b; //第一个数字
int c; //第二个数字
int result;
}sql[10];
//选择习题模式
int selectPra()
{
int kind;
printf("请选择题库:\n");
printf("----------------\n");
printf("1.系统自动生成\n");
printf("2.来自文件\n");
printf("----------------\n");
scanf("%d",&kind);
while(kind!=1&&kind!=2)
{
printf("选择错误,请重新选择:");
scanf("%d",&kind);
}
if(kind==1)
{
makeP