You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
system1/switch函数对应答题,试题插入选项以及管理员密码.c

83 lines
1.5 KiB

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;