成绩管理系统
复制内容到剪贴板
代码:
#include<stdio.h> /* head file*/
#include<stdlib.h>
#include<graphics.h>
#include<conio.h>
#include<bios.h>
#include<time.h>
#define LEFT 70 /* the cursor's place */
#define RIGHT 78
#define UP 72
#define DOWN 80
#define ESC 283
#define ENTER 7181
#define F10 17408 /* enter menu */
#define F1 15104 /* help*/
#define len sizeof(Fname)
long a_sta[50]; /*answer stack*/
union key /*use bioskey*/
{char sym[2];
int sym2;
}KEY,Choose,ans;
union inkey
{int c;
char ch[2];
}sc,key;
static int bx=45,by=5,ex,ey; /*cursor's place*/
FILE *fp,*fp2; /*FILE pointer*/
char filename[20];
int wrong[50]; /*Wrong answer's number*/
struct fname /*student's information*/
{
char filename[20];
char name[20];
int level;
int score;
struct fname *next;
}*message,*head;
typedef struct fname Fname;
void choose_menu(void); /* used funtion*/
void place(int ,int );
void re(int,int);
void Screen(void);
void SFile(void);
void Stest(void);
void Scheck(void);
void choose_act(void);
char *save(void);
void load(void);
void lv1(int,int,int,int,int,int);
void lv2(int,int,int,int,int,int);
void lv3(void);
int ans1(int,int,int,int,int,int,int,int);
void fangkuai(void);
char *intext(int,int);
void loadfile(void);
Fname *save_name(Fname*);
Fname *load_name(Fname*);
Fname *input(Fname*);
void print_list(Fname*);
Fname *sread(Fname*);
void Sl(void);
void pw(void);
void sename(void);
void selv(void);
void sesc(void);
void menu(void);
void Last(void);
void help(void);
void main()
{int i,gdr=DETECT,gmo;
head=(Fname*)malloc(len);
head=NULL;
{if((fp2=fopen("wuxi.txt","rb"))!=NULL) /*information file*/
head=load_name(head);
fclose(fp);
}
initgraph(&gdr,&gmo,"");
menu(); /* the first screen*/
if(key.c==F1)help();
cleardevice();
Screen();
setbkcolor(BLUE);
outtextxy(15,449,"Press F10 into menu");
Choose.sym2=bioskey(0);
while(Choose.sym2!=ESC)
{ if(Choose.sym2==F10)
choose_menu();
Choose.sym2=bioskey(0);
}
closegraph();
}
void choose_menu() /*choose what you want to choose*/
{setcolor(WHITE);
place(bx,by);
KEY.sym2=bioskey(0);
while(KEY.sym2!=ESC)
{re(bx,by);
if(KEY.sym[0]==0)
switch(KEY.sym[1])
{case 0x4b: bx=bx-208;if(bx<=0)bx=461;break;
case 0x4d: bx=bx+208;if(bx>=669)bx=45;break;
}
else
if(KEY.sym2==ENTER)
switch(bx)
{case 45:
Screen();
SFile();
place(bx,by);
choose_act();
break;
case 253:
Screen();
Stest();
place(bx,by);
choose_act();
break;
case 461:
Screen();
Scheck();
place(bx,by);
choose_act();
break;
}
place(bx,by);
KEY.sym2=bioskey(0);
Screen();
}
}
void place(int a0,int a1) /* cover the son_menu*/
{ setfillstyle(SOLID_FILL,WHITE);
bar(a0,a1,a0+60,a1+15);
switch(a0)
{case 45:
setcolor(RED);
outtextxy(50,10,"File");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into FILE,Press ESC to exit");
break;
case 253:setcolor(RED);
outtextxy(258,10,"Test");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into LEVEL,Press ESC to exit");
break;
case 461:
setcolor(RED);
outtextxy(466,10,"Search");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER to SEARCH,Press ESC to exit");
break;
}
}
void re(int a0,int a1) /*cover the main_menu*/
{ setfillstyle(EMPTY_FILL,RED);
setcolor(YELLOW);
bar(a0,a1,a0+80,a1+15);
outtextxy(50,10,"File");
outtextxy(258,10,"Test");
outtextxy(466,10,"Search");
}
void Screen()
{
setfillstyle(SOLID_FILL,BLUE);
bar(1,1,679,479);
setcolor(LIGHTCYAN);
rectangle(10,1,629,25);
rectangle(10,30,629,469);
line(10,439,629,439);
setcolor(YELLOW);
outtextxy(50,10,"File");
outtextxy(258,10,"Test");
outtextxy(466,10,"Search");
}
void SFile()
{setfillstyle(SOLID_FILL,WHITE);
bar(15,20,150,180);
setcolor(BLACK);
rectangle(20,30,140,170);
outtextxy(35,50,"Load");
outtextxy(35,90,"Help");
outtextxy(35,130,"Exit");
}
void Stest()
{setfillstyle(SOLID_FILL,WHITE);
bar(225,20,350,180);
setcolor(BLACK);
rectangle(230,30,340,170);
outtextxy(245,50,"LV1");
outtextxy(245,90,"LV2");
outtextxy(245,130,"LV3");
}
void Scheck()
{setfillstyle(SOLID_FILL,WHITE);
bar(430,20,545,180);
setcolor(BLACK);
rectangle(440,30,535,170);
outtextxy(455,50,"By name");
outtextxy(455,90,"By lv");
outtextxy(455,130,"By score");
}
void choose_act()
{ Fname *p;
ex=bx-15;
ey=by+35;
Choose.sym2=bioskey(0);
while(Choose.sym2!=ESC)
{ setfillstyle(SOLID_FILL,WHITE);
bar(ex,ey,ex+80,ey+20);
switch(bx)
{ case 45:SFile();break;
case 253:Stest();break;
case 461:Scheck();break;
}
setcolor(RED);
if(!Choose.sym[0]){
switch(Choose.sym[1])
{case UP: ey-=40;if(ey<40)ey=120;break;
case DOWN:ey+=40;if(ey>120)ey=40;break;
}
setfillstyle(SOLID_FILL,BLACK);
bar(ex,ey,ex+80,ey+20);
switch(ex)
{ case 30:
switch(ey)
{
case 40:outtextxy(35,50,"Load");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into Open file,Press UP\\DOWN to choose,Press ESC to exit");
break;
case 80:outtextxy(35,90,"Help");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into Save file,Press UP\\DOWN to choose,Press ESC to exit");
break;
case 120:outtextxy(35,130,"Exit");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into Exit dos,Press UP\\DOWN to choose,Press ESC to exit");
break;
}
break;
case 238:
switch(ey)
{
case 40:outtextxy(245,50,"LV1");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into LV1,Press UP\\DOWN to choose,Press ESC to exit");
break;
case 80:outtextxy(245,90,"LV2");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into LV2,Press UP\\DOWN to choose,Press ESC to exit");
break;
case 120:outtextxy(245,130,"LV3");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into LV3,Press UP\\DOWN to choose,Press ESC to exit");
break;
}
break;
case 446:
switch(ey)
{
case 40:outtextxy(455,50,"By name");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into Justice,Press UP\\DOWN to choose,Press ESC to exit");
break;
case 80:outtextxy(455,90,"By lv");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into Return test,Press UP\\DOWN to choose,Press ESC to exit");
break;
case 120:outtextxy(455,130,"By score");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
setcolor(YELLOW);
outtextxy(15,449,"Press ENTER into Exit,Press UP\\DOWN to choose,Press ESC to exit");
break;
}
break;
}
}
else if(Choose.sym2==ENTER)
{
switch(ex)
{ case 30:
switch(ey)
{case 40: load();break;
case 80: help();head=save_name(head);break;
case 120:Last();exit(0);break;
}
break;
case 238:
switch(ey)
{
case 40:head=input(head);p=sread(head);p->level=1;Screen();lv1(20,40,50,125,40,0);p->score+=ans1(95,40,50,125,40,4,0,2);save();head=save_name(head);
Screen(); pw();getch();choose_menu();break;
case 80:head=input(head);p=sread(head);p->level=2;Screen();lv2(20,40,20,150,70,0);p->score+=ans1(125,40,20,150,70,3,0,5);save();head=save_name(head);
Screen(); pw();getch();choose_menu();break;
case 120:head=input(head);p=sread(head);p->level=3;Screen();lv3();p->score+=ans1(90,35,20,125,20,4,0,1);p->score+=ans1(125,115,20,150,20,3,20,2);p->score+=ans1(250,215,10,1,20,0,40,4);save();head=save_name(head);
Screen();pw();getch();choose_menu();
}
break;
case 446:
switch(ey)
{
case 40:sename();break;
case 80:selv();break;
case 120: sesc(); break;
}
break;
}
}
Choose.sym2=bioskey(0);
}
Screen();
}
char *save(void)
{
int i, j;
strcpy(filename,sread(head)->filename);
if((fp=fopen(filename,"wb"))==NULL){
outtext("cannot open this file!");
choose_menu();
}
outtextxy(260,449,"waiting....");
for(i=1;i<=470;i++){
for(j=1;j<=635;j++){
fputc(getpixel(j,i),fp);
}
}
fclose(fp);
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
outtextxy(260,449,"save over!");
setfillstyle(SOLID_FILL,BLUE);
bar(15,471,639,479);
return filename;
}
void load(void)
{
char *choice=" ";
fangkuai();
outtextxy(210,270,"1.load filename");
outtextxy(210,300,"2.load file");
outtextxy(210,330," input your choice:");
strcpy(choice,intext(370,330));
getch();
setfillstyle(SOLID_FILL,BLUE);
bar(200,200,500,400);
switch(*choice)
{case '1': head=load_name(head);print_list(head);break;
case '2': loadfile(); break;
default: return;
}
choose_menu();
}
void loadfile(void)
{ int i,j;
fangkuai();
outtextxy(210,300,"input filename:");
strcpy(filename,intext(350,300));
if((fp=fopen(filename,"rb"))==NULL){
outtext("Cannot open this file!");
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
choose_menu();
}
setfillstyle(SOLID_FILL,BLUE);
bar(11,449,620,459);
outtextxy(260,449,"loading.....");
for(i=1;i<=470;i++){
for(j=1;j<=635;j++){
putpixel(j,i,fgetc(fp));
}
}
getch();
fclose(fp);
}
void lv1(int x,int y,int length,int dx,int dy,int sta)
{
int first,second,mid[4],ans,t,k;
int count;
time_t ti;
char str1[25],str2[25];
int cx=x,cy=y;
srand((unsigned)time(&ti));
for(count=0;count<length;count++)
{
first=rand()%100+1;
second=rand()%100+1;
if(first<second){t=first;first=second;second=t;}
ans=rand()%4+1;
itoa(first,str1,10);
itoa(second,str2,10);
strcat(str2,"=");
switch(ans)
{case 1: a_sta[count+sta]=first+second; outtextxy(cx+10,cy,str1);outtextxy(cx+35,cy,"+");outtextxy(cx+50,cy,str2);break;
case 2: a_sta[count+sta]=first-second; outtextxy(cx+10,cy,str1);outtextxy(cx+35,cy,"-");outtextxy(cx+50,cy,str2);break;
case 3: a_sta[count+sta]=first*second; outtextxy(cx+10,cy,str1);outtextxy(cx+35,cy,"*");outtextxy(cx+50,cy,str2);break;
case 4: a_sta[count+sta]=first/second; outtextxy(cx+10,cy,str1);outtextxy(cx+35,cy,"/");outtextxy(cx+50,cy,str2);break;
}
cx+=dx;
if(cx>x+4*dx){cy+=dy;cx=x;}
}
}
void lv2(int x,int y,int length,int dx,int dy,int sta)
{int num;
long a,b,c,d,t,op1,op2;
int cx=x,cy=y;
char str1[25],str2[25],str3[25];
static time_t ti;
srand((unsigned)time(&ti));
for(num=0;num<length;num++)
{ a=rand()%100+1;
b=rand()%100+1;
c=rand()%100+1;
if(a<b){t=a;a=b;b=t;}
op1=rand()%4+1;
itoa(a,str1,10);
itoa(b,str2,10);
switch(op1)
{case 1: d=a+b;outtextxy(cx,cy,str1);outtextxy(cx+25,cy,"+");outtextxy(cx+40,cy,str2);break;
case 2: d=a-b;outtextxy(cx,cy,str1);outtextxy(cx+25,cy,"-");outtextxy(cx+40,cy,str2);break;
case 3: d=a*b;outtextxy(cx,cy,str1);outtextxy(cx+25,cy,"*");outtextxy(cx+40,cy,str2);break;
case 4: d=a/b;outtextxy(cx,cy,str1);outtextxy(cx+25,cy,"/");outtextxy(cx+40,cy,str2);break;
}
op2=rand()%4+1;
itoa(c,str3,10);
switch(op2)
{case 1: a_sta[num+sta]=d+c;outtextxy(cx+65,cy,"+");outtextxy(cx+80,cy,str3);outtextxy(cx+100,cy,"=");break;
case 2: a_sta[num+sta]=d-c;outtextxy(cx+65,cy,"-");outtextxy(cx+80,cy,str3);outtextxy(cx+100,cy,"=");break;
case 3: a_sta[num+sta]=d*c;outtextxy(cx+65,cy,"*");outtextxy(cx+80,cy,str3);outtextxy(cx+100,cy,"=");break;
case 4: a_sta[num+sta]=d/c;outtextxy(cx+65,cy,"/");outtextxy(cx+80,cy,str3);outtextxy(cx+100,cy,"=");break;
}
if((op1==1||op1==2)&&(op2==3||op2==4)){outtextxy(cx-5,cy,"(");outtextxy(cx+60,cy,")");}
cx+=dx; if(cx>x+3*dx){cy+=dy;cx=x;}
}
}
void lv3()
{long a0;
long n,d,c,t1,t2;
int x=15,y=215;
char str[25];
lv1(15,35,20,125,20,0);
lv2(15,115,20,150,20,20);
for(t1=0;t1<10;t1++)
{
c=rand()%2+1;
if(c==1){a0=rand()%9+1;d=rand()%5+1;n=rand()%99+50;}
else {a0=rand()%3+1;d=rand()%2+1;n=rand()%12+10;}
a_sta[t1+40]=0;
if(c==1)
for(t2=0;t2<n;t2++)
{a_sta[t1+40]+=a0;
ltoa(a0,str,10);
a0=a0+d;
if(t2==0||t2==1||t2==2)
{outtextxy(x,y,str);
outtextxy(x+15,y,"+");
}
if(t2==2)outtextxy(x+25,y,"...");
if(t2==n-1){outtextxy(x+40,y,"+");outtextxy(x+55,y,str);outtextxy(x+120,y,"=");}
if(t2==0||t2==1||t2==2)x+=20;
}
else
for(t2=0;t2<n;t2++)
{a_sta[t1+40]+=a0;
ltoa(a0,str,10);
a0=a0*d;
if(t2==0||t2==1||t2==2)
{outtextxy(x,y,str);
outtextxy(x+15,y,"+");
}
if(t2==2)outtextxy(x+25,y,"...");
if(t2==n-1){outtextxy(x+40,y,"+");outtextxy(x+55,y,str);outtextxy(x+120,y,"=");}
if(t2==0||t2==1||t2==2)x+=20;
}
x=15;
y+=20;
}
}
int ans1(int x,int y,int length,int dx,int dy,int m,int sta,int ds)
{
int num,ax=x,ay=y,i=0,score=0,j=sta;
long anst=0;
char *ch1,*ch/*,daan[25]*/;
for(num=0;num<length;num++)
{ ch1=" ";
ch=" ";
/* ltoa(a_sta[num+sta],daan,10);*/
moveto(ax,ay);
/* outtextxy(ax,ay,daan);*/ /* you can see the answer*/
while(ch[i++]!='\r')
{
ans.sym2=bioskey(0);
if(ans.sym2==F10)choose_menu();
ch1[0]=ans.sym[0];
anst=atol(ch1)+anst*10;
outtext(ch1);
ch[i]=ch1[0];
}
ch[--i]='\0';
anst/=10;
if(a_sta[num+sta]<0)anst=-anst;
if(anst==a_sta[num+sta])score=score+ds;
else {wrong[j++]=num+sta+1;
}
ax+=dx;
if(ax>x+m*dx){ax=x;ay+=dy;}
anst=0;
}
return score;
}
void pw(void)
{Fname *p;
int i,x=350,y=250;
char str[25],str1[25];
setfillstyle(SOLID_FILL,BLUE);
bar(200,200,500,400);
p=sread(head);
itoa(p->score,str,10);
fangkuai();
setcolor(RED);
outtextxy(210,230,"SCORE:");
outtextxy(350,230,str);
outtextxy(230,250,"WRONG:");
for(i=0;i<50;i++)
{if(wrong[i]!=0)
{itoa(wrong[i],str1,10);
outtextxy(x,y,str1);
x+=40;
if(x>450){y+=20;x=230;}
}
}
getch();
setfillstyle(SOLID_FILL,BLUE);
bar(200,200,500,430);
setcolor(YELLOW);
}
void fangkuai(void)
{int i,j;
for(j=200;j<=400;j++)
for(i=200;i<=500;i++)
putpixel(i,j,15^getpixel(i,j));
}
char *intext(int x,int y)
{char *ch,*ch1;
int i=0;
moveto(x,y);
ch1=" ";
ch=" ";
do
{
sc.c=bioskey(0);
ch1[0]=sc.ch[0];
outtext(ch1);
ch[i]=ch1[0];
}while(!(ch[i++]=='\r'));
ch[--i]='\0';
return(ch);
}
Fname *save_name(Fname *head)
{
Fname *info;
if((fp2=fopen("wuxi.txt","wb"))==NULL)
{outtext("cannot open this file\n");
choose_menu();
}
else
info=head;
while(info!=NULL)
{ if((fp=fopen(info->filename,"rb"))!=NULL)
fwrite(info,sizeof(Fname),1,fp2);
info=info->next;
}
fclose(fp);
fclose(fp2);
return(head);
}
Fname *load_name(Fname *head)
{
Fname *last,*info;
if((fp=fopen("wuxi.txt","rb"))==NULL){
outtext("Cannot open file.\n");
choose_menu();
}
head=(Fname*)malloc(len);
fread(head,len,1,fp);
last=head;
while(!feof(fp))
{ info=(Fname *)malloc(len);
if(!info){
printf("Out of Memory");
}
if(1!=fread(info,len,1,fp)) break;
last->next=info;
last=info;
}
fclose(fp);
return(head);
}
Fname *input(Fname *ht)
{
Fname *p1,*p2,*c;
char com[20];
setfillstyle(SOLID_FILL,BLUE);
bar(200,200,500,400);
fangkuai();
outtextxy(210,210,"input filename:");
if(ht!=NULL)
{
p1=(Fname*)malloc(len);
p2=(Fname*)malloc(len);
p2=ht;
while(p2->next!=NULL)
p2=p2->next;
strcpy(com,intext(350,210));
c=ht;
while(c!=NULL)
{
if(strcmp(c->filename,com)==0){outtext("REPEATED NAME");getch();return input(ht);}
else c=c->next;
}
if((fp=fopen(com,"wb"))==NULL){outtextxy(220,240,"Cannot open this file");getch();return input(ht);}
else{
strcpy(p1->filename,com);
outtextxy(210,350,"Input name:");
strcpy(p1->name,intext(350,350));
p1->score=0;
p1->next=NULL;
p2->next=p1;
p2=p1->next;
}
}
else
{ht=(Fname*)malloc(len);
strcpy(com,intext(350,210));
if((fp=fopen(com,"wb"))==NULL){outtextxy(220,240,"Cannot open this file");getch();return input(ht);}
else{
strcpy(ht->filename,com);
outtextxy(210,350,"Input name:");
strcpy(ht->name,intext(350,350));
ht->score=0;
ht->next=NULL;
}
}
getch();
setfillstyle(SOLID_FILL,BLUE);
bar(200,200,500,400);
return(ht);
}
void print_list(Fname *ht)
{
Fname *p;
int i=60,j=40;
char str[25];
Sl();
p=ht;
settextstyle(0,0,1);
while(p!=NULL)
{itoa(p->score,str,10);
outtextxy(i,j,p->filename);
outtextxy(i+150,j,p->name);
switch(p->level)
{case 1: outtextxy(i+300,j,"lv1");break;
case 2: outtextxy(i+300,j,"lv2");break;
case 3: outtextxy(i+300,j,"lv3");break;
}
outtextxy(i+450,j,str);
p=p->next;
j=j+10;
}
getch();
settextstyle(0,0,0);
Screen();
choose_menu();
}
void Sl(void)
{
setfillstyle(SOLID_FILL,YELLOW);
bar(0,0,639,479);
setlinestyle(0,0,1);
settextstyle(0,0,2);
outtextxy(150,2,"-----INFORMATION----");
outtextxy(130,430,"--PRESS ANY KEY TO RETURN--");
rectangle(50,25,589,419);
settextstyle(0,0,1);
outtextxy(60,30,"FILENAME");
outtextxy(210,30,"NAME");
outtextxy(360,30,"LEVEL");
outtextxy(510,30,"SCORE");
line(50,38,589,38);
setlinestyle(0,0,3);
}
Fname *sread(Fname *head)
{Fname *last,*info;
info=head;
while(info!=NULL)
{last=info;
info=info->next;
}
return(last);
}
void sename(void)
{char str1[25],str[25];
int i=60,j=40;
Fname *p;
fangkuai();
outtextxy(210,300,"input name:");
strcpy(str1,intext(300,300));
Sl();
p=head;
settextstyle(0,0,1);
while(p!=NULL)
{if(strcmp(str1,p->name)==0)
{itoa(p->score,str,10);
outtextxy(i,j,p->filename);
outtextxy(i+150,j,p->name);
switch(p->level)
{case 1: outtextxy(i+300,j,"lv1");break;
case 2: outtextxy(i+300,j,"lv2");break;
case 3: outtextxy(i+300,j,"lv3");break;
}
outtextxy(i+450,j,str);
j=j+10;
}
p=p->next;
}
if(j==40)outtextxy(i,j,"CANNOT FIND THE NAME!");
getch();
settextstyle(0,0,0);
Screen();
choose_menu();
}
void selv(void)
{char str1[25],str[25];
int i=60,j=40,lv;
Fname *p;
fangkuai();
outtextxy(210,300,"input level:");
strcpy(str1,intext(300,300));
lv=atoi(str1);
Sl();
p=head;
settextstyle(0,0,1);
while(p!=NULL)
{if(p->level==lv)
{itoa(p->score,str,10);
outtextxy(i,j,p->filename);
outtextxy(i+150,j,p->name);
switch(p->level)
{case 1: outtextxy(i+300,j,"lv1");break;
case 2: outtextxy(i+300,j,"lv2");break;
case 3: outtextxy(i+300,j,"lv3");break;
}
outtextxy(i+450,j,str);
j=j+10;
}
p=p->next;
}
if(j==40)outtextxy(i,j,"CANNOT FIND THE LEVEL!");
getch();
settextstyle(0,0,0);
Screen();
choose_menu();
}
void sesc(void)
{char str1[25],str[25];
int i=60,j=40,score;
Fname *p;
fangkuai();
outtextxy(210,300,"input score:");
strcpy(str1,intext(300,300));
score=atoi(str1);
Sl();
p=head;
settextstyle(0,0,1);
while(p!=NULL)
{if(p->score==score)
{itoa(p->score,str,10);
outtextxy(i,j,p->filename);
outtextxy(i+150,j,p->name);
switch(p->level)
{case 1: outtextxy(i+300,j,"lv1");break;
case 2: outtextxy(i+300,j,"lv2");break;
case 3: outtextxy(i+300,j,"lv3");break;
}
outtextxy(i+450,j,str);
j=j+10;
}
p=p->next;
}
if(j==40)outtextxy(i,j,"CANNOT FIND THE SCORE!");
getch();
settextstyle(0,0,0);
Screen();
choose_menu();
}
void menu(void)
{char subject[28]="Arithmatic System",
name[28]="Wu XiaoHui",
class[28]="Computer 4",
no[28]="2001374424",
help[40]="<Press F1 into help>";
time_t ti;
srand((unsigned)time(&ti));
setbkcolor(BLUE);
{setcolor(LIGHTGREEN);
setlinestyle(SOLID_LINE,0,3);
rectangle(80,85,530,150);
}
settextstyle(0,0,1);
setcolor(YELLOW);
outtextxy(150,300,"Designer:");
outtextxy(300,300,name);
outtextxy(150,320,"Class:");
outtextxy(300,320,class);
outtextxy(150,340,"Number:");
outtextxy(300,340,no);
outtextxy(200,460,help);
while(!kbhit())
{
setcolor(rand()%14+1);
settextstyle(4,0,6);
outtextxy(100,90,subject);
delay(100000);
}
key.c=bioskey(0);
settextstyle(0,0,1);
}
void Last(void)
{char bye[20]="THANK YOU",
good[20]="VISIT MY SYSTEM";
int r;
cleardevice();
setbkcolor(BLUE);
settextstyle(1,0,7);
setcolor(YELLOW);
outtextxy(150,80,bye);
outtextxy(50,200,good);
rectangle(20,20,629,469);
sleep(1);
}
void help(void)
{int i,a,b;
setfillstyle(SOLID_FILL,CYAN);
bar(0,0,639,479);
setlinestyle(0,0,1);
settextstyle(0,0,2);
setcolor(RED);
outtextxy(150,2,"-----INFORMATION----");
outtextxy(130,430,"--PRESS ANY KEY TO RETURN--");
rectangle(50,25,589,419);
settextstyle(0,0,1);
outtextxy(100,50,"1.Press F10 ,you can choose the menu.");
outtextxy(100,70,"2.Press \30 or \31 to choose son_menu.");
outtextxy(100,90,"3.Choose File ,you can see the filename or test paper.");
outtextxy(100,110,"4.If you finish the paper ,please waiting for saving.");
outtextxy(100,130,"5.Don't type any other nonscene,or it will run wrong");
outtextxy(100,150,"6.Something you can see in the menu's underside");
outtextxy(100,170,"7.Before doing the paper,you must input your imformation.");
setlinestyle(0,0,3);
a=320;
b=320;
while(!kbhit())
{a=(a++)%639;
if(a==639)a=321;
b--;
if(b==0)b=319;
for(i=0;i<=479;i++)
{putpixel(a,i,15^getpixel(a,i));
putpixel(b,i,15^getpixel(b,i));
}
}
settextstyle(0,0,1);
Screen();
choose_menu();
}