|
|
|
@ -0,0 +1,205 @@
|
|
|
|
|
#include"文件保存题库以及读取题库1.c"
|
|
|
|
|
#include"输入和插入试题函数.c"
|
|
|
|
|
#include"输出试题函数以及判题函数.c"
|
|
|
|
|
void main()//开始界面
|
|
|
|
|
{
|
|
|
|
|
int q=5000,p=5,t=1000;
|
|
|
|
|
int j,m=2,judge=0;
|
|
|
|
|
char flag='N';
|
|
|
|
|
int N=0,i,sum,score=0,a;
|
|
|
|
|
printf("输入建立题目文件题目数:");
|
|
|
|
|
scanf("%d",&N);
|
|
|
|
|
getchar();
|
|
|
|
|
system("cls");
|
|
|
|
|
ReadNode(N);
|
|
|
|
|
while(flag=='N'||flag=='n')
|
|
|
|
|
{
|
|
|
|
|
printf("\n 来了\n\n 老弟\n\n 准备好了吗?!\n");
|
|
|
|
|
printf("\t\t******************************************\n");
|
|
|
|
|
printf("\t\t| 单项选择题标准化考试系统 |\n");
|
|
|
|
|
printf("\t\t| |\n");
|
|
|
|
|
printf("\t\t| 1.答题 |\n");
|
|
|
|
|
printf("\t\t| |\n");
|
|
|
|
|
printf("\t\t| 2.试题插入 |\n");
|
|
|
|
|
printf("\t\t| |\n");
|
|
|
|
|
printf("\t\t| 3.试题输入 |\n");
|
|
|
|
|
printf("\t\t| |\n");
|
|
|
|
|
printf("\t\t| 4.保存试题到文件 |\n");
|
|
|
|
|
printf("\t\t| |\n");
|
|
|
|
|
printf("\t\t| 5.退出考试系统 |\n");
|
|
|
|
|
printf("\t\t******************************************\n");
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
printf("\t\t 请选择序号:");
|
|
|
|
|
scanf("%d",&a);
|
|
|
|
|
getchar();
|
|
|
|
|
switch(a)
|
|
|
|
|
{
|
|
|
|
|
case 1:system("cls");//答题
|
|
|
|
|
char b;
|
|
|
|
|
printf("请输入你想要的答题数目:");
|
|
|
|
|
scanf("%d",&sum);
|
|
|
|
|
getchar();
|
|
|
|
|
answer(sum);
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("按回车返回主界面");
|
|
|
|
|
scanf("%c",&b);
|
|
|
|
|
if(b=='\n')
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2:system("cls");//试题插入
|
|
|
|
|
char code2[50]={"jiehe"},check2[50];//输入管理员密码
|
|
|
|
|
printf("请输入管理员密码:");
|
|
|
|
|
for(j=1;j<=3;j++)
|
|
|
|
|
{
|
|
|
|
|
scanf("%s",check2);
|
|
|
|
|
getchar();
|
|
|
|
|
system("cls");
|
|
|
|
|
if(!strcmp(code2,check2))
|
|
|
|
|
{
|
|
|
|
|
printf("密码正确\n");
|
|
|
|
|
Sleep(t);
|
|
|
|
|
system("cls");
|
|
|
|
|
judge=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("密码输入错误,您还有%d次机会\n",m);
|
|
|
|
|
m--;
|
|
|
|
|
if(m==1&&!strcmp(code2,check2))
|
|
|
|
|
{
|
|
|
|
|
printf("密码正确\n");
|
|
|
|
|
Sleep(t);
|
|
|
|
|
system("cls");
|
|
|
|
|
judge=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(m==0&&!strcmp(code2,check2))
|
|
|
|
|
{
|
|
|
|
|
printf("密码正确\n");
|
|
|
|
|
Sleep(t);
|
|
|
|
|
system("cls");
|
|
|
|
|
judge=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
judge=2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
m=2;
|
|
|
|
|
if(judge==1)
|
|
|
|
|
{
|
|
|
|
|
InsertNode(N);
|
|
|
|
|
}
|
|
|
|
|
N++;
|
|
|
|
|
system("cls");
|
|
|
|
|
if(judge==2)
|
|
|
|
|
{
|
|
|
|
|
while (p>0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\n\n\n\n\n\n\n\n\n");
|
|
|
|
|
printf("\t\t\t您可能是非法闯入!\n");
|
|
|
|
|
printf("\t\t\t五秒后将自动返回开始界面!\n");
|
|
|
|
|
printf("\t\t\t五秒后您可以重新输入!\n");
|
|
|
|
|
printf("\t\t\t时间还剩%d秒",p);
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
system("cls");
|
|
|
|
|
p--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
p=5;
|
|
|
|
|
system("cls");
|
|
|
|
|
break;
|
|
|
|
|
case 3:system("cls");//试题输入
|
|
|
|
|
char code1[50]={"jiehe"},check1[50];//输入管理员密码
|
|
|
|
|
printf("请输入管理员密码:");
|
|
|
|
|
for(j=1;j<=3;j++)
|
|
|
|
|
{
|
|
|
|
|
scanf("%s",check1);
|
|
|
|
|
getchar();
|
|
|
|
|
system("cls");
|
|
|
|
|
if(!strcmp(code1,check1))
|
|
|
|
|
{
|
|
|
|
|
printf("密码正确\n");
|
|
|
|
|
Sleep(t);
|
|
|
|
|
system("cls");
|
|
|
|
|
judge=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("密码输入错误,您还有%d次机会\n",m);
|
|
|
|
|
m--;
|
|
|
|
|
if(m==1&&!strcmp(code1,check1))
|
|
|
|
|
{
|
|
|
|
|
printf("密码正确\n");
|
|
|
|
|
Sleep(t);
|
|
|
|
|
system("cls");
|
|
|
|
|
judge=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(m==0&&!strcmp(code1,check1))
|
|
|
|
|
{
|
|
|
|
|
printf("密码正确\n");
|
|
|
|
|
Sleep(t);
|
|
|
|
|
system("cls");
|
|
|
|
|
judge=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
judge=2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
m=2;
|
|
|
|
|
if(judge==1)
|
|
|
|
|
{
|
|
|
|
|
InputTitle(N);
|
|
|
|
|
}
|
|
|
|
|
system("cls");
|
|
|
|
|
if(judge==2)
|
|
|
|
|
{
|
|
|
|
|
while (p>0)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\n\n\n\n\n\n\n\n\n");
|
|
|
|
|
printf("\t\t\t您可能是非法闯入!\n");
|
|
|
|
|
printf("\t\t\t五秒后将自动返回开始界面!\n");
|
|
|
|
|
printf("\t\t\t五秒后您可以重新输入!\n");
|
|
|
|
|
printf("\t\t\t时间还剩%d秒",p);
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
system("cls");
|
|
|
|
|
p--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
p=5;
|
|
|
|
|
system("cls");
|
|
|
|
|
break;
|
|
|
|
|
case 4:system("cls");//保存试题到文件
|
|
|
|
|
char c;
|
|
|
|
|
if(SaveNode(N))
|
|
|
|
|
printf("保存成功!\n");
|
|
|
|
|
else printf("保存失败!\n");
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("按回车返回主界面");
|
|
|
|
|
scanf("%c",&c);
|
|
|
|
|
if(c=='\n')
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 5:system("cls");//退出考试系统
|
|
|
|
|
printf("你将退出考试系统(Y or N?)\n");
|
|
|
|
|
scanf("%c",&flag);
|
|
|
|
|
getchar();
|
|
|
|
|
if(flag=='Y'||flag=='y')
|
|
|
|
|
exit(0);
|
|
|
|
|
system("cls");
|
|
|
|
|
break;
|
|
|
|
|
default:system("cls");
|
|
|
|
|
printf("请输入正确的选择:\n");
|
|
|
|
|
Sleep(t);
|
|
|
|
|
system("cls");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|