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.

43 lines
833 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#define M 100
void browse()
{typedef struct question{
char mainq[500];
char ala[150];
char alb[150];
char alc[150];
char ald[150];
char ans;
}ques;
char _m[20]="password";
char _n[20];
int z=3;
while(z--)
{
printf("你还有%d次机会输入管理员密码",z+1);//密码:password
scanf("%s",_n);
printf("\n");
if(strcmp(_m,_n)==0)
{
ques que[1000];
FILE *fp=fopen("question.dat","rb");
int i;
for(i=0;fread(&que[i],sizeof(ques),1,fp)==1;i++)//当fread函数返回值不为1时代表已经到文件末尾
{
printf("%d.%s\n",i+1,que[i].mainq);
printf("A.%s\n",que[i].ala);
printf("B.%s\n",que[i].alb);
printf("C.%s\n",que[i].alc);
printf("D.%s\n",que[i].ald);
printf("正确选项:%c\n\n",que[i].ans);
}
fclose(fp);
break;
}
}
return ;
}