太极实业更名十一科技:C语言大型课程设计!!!急需!!!

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/27 01:24:59
我们设计C语言课程设计,关于课程设计的,求助大家!!!帮帮忙!小虫在此谢谢大家了!!!

#define RECORD record.txt
#define X1 6
#define X2 2
#include
#include
#include
#include
#include
#include
/*#include "class/CARTOON.C"*/
/*definition struct*/
struct
{
char name[10];
char sex;
int studID;
int classID;
int english;
int math;
int computer;
int recycle;
int average;
int total;
int sort;
}stud,temp2;

void cartoon(void)
{
float x,x1=0;
char ch;
int driver,i,mode,y=0;
void base(void);
void clr(int x,int y);
void w(int x,int y);
void e(int x,int y);
void l(int x,int y);
void c(int x,int y);
void o(int x,int y);
void m(int x,int y);
printf("Do you want play the face?Y/N");
ch=getchar();getchar();
if(ch=='N'||ch=='n')return;
driver=VGA;mode=VGAHI;
initgraph(&driver,&mode,"");
x=620;
for(i=0;i<=200;i++)
{
setcolor(0);line(0,80,640,80);line(0,420,640,420);
setcolor(15);line(640-x1,80,640,80);line(0,420,x1+=4.1,420);
delay(1000);
}
y=81;
for(i=0;i<20;i++)
{ setcolor(0);line(0,y,640,y);y+=2;
setcolor(15);line(0,y,640,y); delay(3000);
}

settextstyle(1,0,3);

setfillstyle(SOLID_FILL,0);
clr(189,94);
clr(230,94);
clr(300,94);
clr(380,94);
delay(5000);
setcolor(7);
outtextxy(181,91,"My C Language Designs");
setcolor(15);
outtextxy(180,90,"My C Language Designs");
setcolor(7);
delay(10000);
outtextxy(182,92,"My C Language Designs");
setcolor(7);
outtextxy(181,91,"My C Language Designs");
setcolor(15);
outtextxy(180,90,"My C Language Designs");
delay(10000);
settextstyle(1,0,4);
setfillstyle(SOLID_FILL,0);
for(i=0;i<100;i+=3)
{ bar(1,1,640,77);
outtextxy(71,i*0.4,"Student Scores Manage System");
delay(200000);
}
for(i=0;i<301;i+=4)
{
line(50,121,50,121+i);line(590,121,590,121+i);
delay(2000);
}
settextstyle(1,0,4);
for(i=0;i<170;i+=2)
{
line(50,150,50+i,150);line(590,150,590-i,150);
delay(2000);
}
x=190;
y=130;
i=0;
while(i<9)
{ switch(i++)
{
case 1:w(x+20*i,y);break;
case 2:e(x+21*i,y);break;
case 3:l(x+20*i,y);break;
case 4:l(x+20*i,y);break;
case 5:c(x+20*i,y);break;
case 6:o(x+20*i,y);break;
case 7:m(x+20*i,y);break;
case 8:e(x+22*i,y);break;
}
}
delay(20000);
circle(570,170,10);
delay(20000);
circle(480,250,40);
delay(20000);
circle(320,280,80);
delay(20000);
circle(150,330,40);
delay(20000);
circle(70,400,10);
settextstyle(1,0,4);
outtextxy(70,170,"Design");
settextstyle(1,0,7);
outtextxy(283,240,"By");
settextstyle(1,0,4);
outtextxy(430,370,"GongTao");
settextstyle(1,0,3);
outtextxy(150,430,"HuNan Agracutural University");
getch();
setfillstyle(LINE_FILL,1);
for(i=480;i>0;i-=25)
{
bar(1,1,640,480-i);
delay(2000);
}
setfillstyle(SOLID_FILL,1);
for(i=0;i<480;i+=25)
{
bar(1,479-i,649,479);
delay(2000);
}

return;
}

void base(void)
{
setcolor(15);line(0,80,640,80);line(0,420,640,420);line(0,121,640,121);
}

void clr(int x,int y)
{int r=300;
static i=0;
void base(void);
i++;
for(r=300;r>0;r-=6)
{
circle(x,y,r);
delay(2000);
setcolor(0);
circle(x,y,r);
base();
setcolor(15);
switch(i)
{
case 2: outtextxy(180,90,"My"); break;
case 3: outtextxy(180,90,"My C ");break;
case 4: outtextxy(180,90,"My C Language");break;
}
}
switch(i)
{
case 1: outtextxy(180,90,"My"); break;
case 2: outtextxy(180,90,"My C ");break;
case 3: outtextxy(180,90,"My C Language");break;
case 4: outtextxy(180,90,"My C Language Designs");break;
}
}

void w(int x,int y)
{
outtextxy(x,y,"W");
delay(2000);
}
void e(int x,int y)
{
outtextxy(x,y,"e");
delay(2000);
}

void l(int x,int y)
{
outtextxy(x,y,"l");
delay(2000);
}
void c(int x,int y)
{
outtextxy(x,y,"c");
delay(2000);
}
void o(int x,int y)
{
outtextxy(x,y,"o");
delay(2000);
}
void m(int x,int y)
{
outtextxy(x,y,"m");
delay(2000);
}

main()
{
int go,isend;
void add(void);
void list(void);
int face(void);
void del(void);
void modify(void);
void search(void);
void sort(void);
void insert(void);
void recovery(void);
void statistics(void);
void recycle(void);
void cartoon(void);
void realdel(void);
cartoon();
while(1)
{
go=face();
switch(go)
{
case 1: add();break;
case 2: list();break;
case 3: del();break;
case 4: modify();break;
case 5: search();break;
case 6: sort();break;
case 7: insert();break;
case 8: recovery();break;
case 9: statistics();break;
case 10:recycle();break;
case 11:realdel();break;
case 0:exit(0);break;
}
}
}

/* add a new record*/
void add(void)
{int Y1=3;
char numstr[20],ch;
FILE *fp;
cleardevice();
if((fp=fopen("RECORD","ab"))==NULL)
{ printf("Cant't open file.");getch();exit(0);}
gotoxy(X1,Y1);
printf("Name");
gotoxy(X1+9,Y1);
printf("Sex");
gotoxy(X1+(2*9),Y1);
printf("StudID");
gotoxy(X1+(3*9),Y1);
printf("ClassID");
gotoxy(X1+(4*9),Y1);
printf("English");
gotoxy(X1+(5*9),Y1);
printf("Math");
gotoxy(X1+(6*9),Y1);
printf("Computer");
gotoxy(X1,++Y1);
do{
gotoxy(0,Y1);clreol();
gotoxy(X1,Y1);/*return start position*/printf("\b%c",16);
gets(stud.name);gotoxy(X1+9,Y1);printf("\b%c",16);
stud.sex=getchar();getchar();gotoxy(X1+(2*9),Y1);printf("\b%c",16);
gets(numstr);stud.studID=atoi(numstr);gotoxy(X1+(3*9),Y1);printf("\b%c",16);
gets(numstr);stud.classID=atoi(numstr);gotoxy(X1+(4*9),Y1);printf("\b%c",16);
gets(numstr);stud.english=atoi(numstr);gotoxy(X1+(5*9),Y1);printf("\b%c",16);
gets(numstr);stud.math=atoi(numstr);gotoxy(X1+(6*9),Y1);printf("\b%c",16);
gets(numstr);stud.computer=atoi(numstr);gotoxy(X1,Y1+1);
stud.recycle=0;stud.sort=0;
stud.total=stud.english+stud.computer+stud.math;
stud.average=(stud.total)/3;
fwrite(&stud,sizeof(stud),1,fp);
printf("Add again?(y/n)");
ch=getchar();getchar();
gotoxy(X1,++Y1);
}while(ch=='y' || ch=='Y');
fclose(fp);
return;
}
/*end add*/

/*list all record*/
void list(void)
{
int Y1=3,i=0,sum=0,once=1,i2=0;
FILE *fp;
cleardevice();
if((fp=(fopen("RECORD","rb")))==NULL)
{printf("I can not open this file.");getch();return;}
while(fread(&stud,sizeof(stud),1,fp)) sum++;
rewind(fp);
if(sum==0)
{printf("\nNo record in file.Pass any key return to Menu..");getch();return;}
while(fread(&stud,sizeof(stud),1,fp)==1)
{ if(once==1)
{Y1=2;
clrscr();
gotoxy(X2,Y1);
printf("Name");
gotoxy(X2+9,Y1);
printf("Sex");
gotoxy(X2+(2*9),Y1);
printf("StudID");
gotoxy(X2+(3*9),Y1);
printf("ClassID");
gotoxy(X2+(4*9),Y1);
printf("English");
gotoxy(X2+(5*9),Y1);
printf("Math");
gotoxy(X2+(6*9),Y1);
printf("Computer");
gotoxy(X2+(7*9),Y1);
printf("Aver");
gotoxy(X2+(8*9),Y1++);
printf("Total");
once=0;
}
if(!stud.recycle)
{
gotoxy(X2,Y1);
printf("%s",stud.name);gotoxy(X2+(1*9),Y1);
printf("%c",stud.sex);gotoxy(X2+(2*9),Y1);
printf("%d",stud.studID);gotoxy(X2+(3*9),Y1);
printf("%d",stud.classID);gotoxy(X2+(4*9),Y1);
printf("%d",stud.english);gotoxy(X2+(5*9),Y1);
printf("%d",stud.math);gotoxy(X2+(6*9),Y1);
printf("%d",stud.computer);gotoxy(X2+(7*9),Y1);
printf("%d",stud.average);gotoxy(X2+(8*9),Y1);
printf("%d",stud.total);gotoxy(X2,++Y1);++i2;
}
if(++i==sum)
{printf("\nPress any key return to Menu.....");getch();}
if(sum>20&&i2!=0)
{if((i2%20)==0){printf("\nPress any key to continue.....");getch();once=1;}}
}
fclose(fp);
return;
}
/*end list*/

/*Delete record start*/
void del(void)
{
int go,Y1=3,once=0,sum=0;
char numstr[20],yn='n';
FILE *fp,*temp;
cleardevice();
temp=fopen("temp.txt","wb");
if((fp=(fopen("RECORD","rb")))==NULL)
{printf("I can not open this file.");getch();return;}
printf("Choose the StudID:");
gets(numstr);go=atoi(numstr);

while(fread(&stud,sizeof(stud),1,fp))
{
if(!stud.recycle&&stud.studID==go)
{sum++;
if(++once==1)
{
gotoxy(X2,Y1);
printf("Name");
gotoxy(X2+9,Y1);
printf("Sex");
gotoxy(X2+(2*9),Y1);
printf("StudID");
gotoxy(X2+(3*9),Y1);
printf("ClassID");
gotoxy(X2+(4*9),Y1);
printf("English");
gotoxy(X2+(5*9),Y1);
printf("Math");
gotoxy(X2+(6*9),Y1);
printf("Computer");
gotoxy(X2+(7*9),Y1);
printf("Total");
gotoxy(X2+(8*9),Y1++);
printf("Aver");
}
gotoxy(X2,Y1);clreol();
printf("%s",stud.name);gotoxy(X2+(1*9),Y1);
printf("%c",stud.sex);gotoxy(X2+(2*9),Y1);
printf("%d",stud.studID);gotoxy(X2+(3*9),Y1);
printf("%d",stud.classID);gotoxy(X2+(4*9),Y1);
printf("%d",stud.english);gotoxy(X2+(5*9),Y1);
printf("%d",stud.math);gotoxy(X2+(6*9),Y1);
printf("%d",stud.computer);gotoxy(X2+(7*9),Y1);
printf("%d",stud.average);gotoxy(X2+(8*9),Y1);
printf("%d",stud.total);gotoxy(X2,++Y1);
printf("Do you want to delete this record?y/n");yn=getchar();getchar();
if(yn=='n'||yn=='N'){fwrite(&stud,sizeof(stud),1,temp);yn='s';}
else{stud.recycle=1;fwrite(&stud,sizeof(stud),1,temp);yn='s';}
}
if(yn!='s')
{fwrite(&stud,sizeof(stud),1,temp);yn='';}
yn='';
}
if(!sum)
{printf("No record! Press any key return to Menu...");fclose(fp);
fclose(temp);
remove("RECORD");
rename("temp.txt","RECORD");getch();
return; }
fclose(fp);
fclose(temp);
remove("RECORD");
rename("temp.txt","RECORD");
return;
}
/*Delete record end*/

/*Modify start*/
void modify(void)
{
int go,Y1=3,once=0,sum=0;
char numstr[20],yn='n';
FILE *fp,*temp;
temp=fopen("temp.txt","wb");
if((fp=(fopen("RECORD","rb")))==NULL)
{printf("I can not open this file.");getch();return;}
cleardevice();
printf("Choose the StudID:");
scanf("%d",&go);getchar();
while(fread(&stud,sizeof(stud),1,fp))
{
if(!stud.recycle&&stud.studID==go)
{
sum++;
if(++once==1)
{ Y1=2;
gotoxy(X1,Y1);
printf("Name");
gotoxy(X1+9,Y1);
printf("Sex");
gotoxy(X1+(2*9),Y1);
printf("StudID");
gotoxy(X1+(3*9),Y1);
printf("ClassID");
gotoxy(X1+(4*9),Y1);
printf("English");
gotoxy(X1+(5*9),Y1);
printf("Math");
gotoxy(X1+(6*9),Y1);
printf("Computer");
gotoxy(X1,++Y1);
}
gotoxy(X1,Y1);clreol();
printf("%s",stud.name);
gotoxy(X1+9,Y1);
printf("%c",stud.sex);
gotoxy(X1+(2*9),Y1);
printf("%d",stud.studID);
gotoxy(X1+(3*9),Y1);
printf("%d",stud.classID);
gotoxy(X1+(4*9),Y1);
printf("%d",stud.english);
gotoxy(X1+(5*9),Y1);
printf("%d",stud.math);
gotoxy(X1+(6*9),Y1);
printf("%d",stud.computer);
gotoxy(X1,Y1+1);printf("Do you want to modify this record?y/n");yn=getchar(); getchar();
if(yn=='n'||yn=='N')
{fwrite(&stud,sizeof(stud),1,temp);yn='s';Y1++;}
else
{
gotoxy(X1,++Y1);clreol();printf("\b%c",16);/*return start position*/
gets(stud.name);gotoxy(X1+9,Y1);printf("\b%c",16);
stud.sex=getchar();getchar();gotoxy(X1+(2*9),Y1);printf("\b%c",16);
gets(numstr);stud.studID=atoi(numstr);gotoxy(X1+(3*9),Y1);printf("\b%c",16);
gets(numstr);stud.classID=atoi(numstr);gotoxy(X1+(4*9),Y1);printf("\b%c",16);
gets(numstr);stud.english=atoi(numstr);gotoxy(X1+(5*9),Y1);printf("\b%c",16);
gets(numstr);stud.math=atoi(numstr);gotoxy(X1+(6*9),Y1);printf("\b%c",16);
gets(numstr);stud.computer=atoi(numstr);gotoxy(X1,Y1+++1);
stud.recycle=0;
stud.total=stud.english+stud.computer+stud.math;
stud.average=(stud.total)/3;
fwrite(&stud,sizeof(stud),1,temp);yn='s';printf("Modify Successfully!!");
}
}
if(yn!='s')
{fwrite(&stud,sizeof(stud),1,temp);yn='';}
yn='';
}
if(!sum)
{printf("\nPress any key return to Menu....");fclose(fp);fclose(temp);remove("temp.txt");getch();return;}
fclose(fp);
fclose(temp);
remove("RECORD");
rename("temp.txt","RECORD");
getch();
return;
}
/*Modify end*/

/*Search start*/
void search(void)
{
int go,Y1=3,once=0,i=0;
char numstr[20];
FILE *fp;
if((fp=(fopen("RECORD","rb")))==NULL)
{printf("I can not open this file.");getch();return;}
cleardevice();
printf("Input the StudID:");
gets(numstr);go=atoi(numstr);
while(fread(&stud,sizeof(stud),1,fp))
{
if(!stud.recycle&&stud.studID==go)
{
if(++once==1)
{ Y1=2;
gotoxy(X2,Y1);
printf("Name");
gotoxy(X2+9,Y1);
printf("Sex");
gotoxy(X2+(2*9),Y1);
printf("StudID");
gotoxy(X2+(3*9),Y1);
printf("ClassID");
gotoxy(X2+(4*9),Y1);
printf("English");
gotoxy(X2+(5*9),Y1);
printf("Math");
gotoxy(X2+(6*9),Y1);
printf("Computer");
gotoxy(X2+(7*9),Y1);
printf("Total");
gotoxy(X2+(8*9),Y1++);
printf("Aver");
}
gotoxy(X2,Y1);clreol();
printf("%s",stud.name);gotoxy(X2+(1*9),Y1);
printf("%c",stud.sex);gotoxy(X2+(2*9),Y1);
printf("%d",stud.studID);gotoxy(X2+(3*9),Y1);
printf("%d",stud.classID);gotoxy(X2+(4*9),Y1);
printf("%d",stud.english);gotoxy(X2+(5*9),Y1);
printf("%d",stud.math);gotoxy(X2+(6*9),Y1);
printf("%d",stud.computer);gotoxy(X2+(7*9),Y1);
printf("%d",stud.average);gotoxy(X2+(8*9),Y1);
printf("%d",stud.total);gotoxy(X2,++Y1); i++;
if(i%20==0){printf("Press any key to continue…");getch();once=0;}
}
}
printf("Press any key return to Menu....");getch();
fclose(fp);
return;
}
/*Search end*/

/*Insert start*/
void insert(void)
{
int go,Y1=3,once=0,sum=0;
char numstr[20],yn='n';
FILE *fp,*temp;
temp=fopen("temp.txt","wb");
if((fp=(fopen("RECORD","rb")))==NULL)
{printf("I can not open this file.");getch();return;}
cleardevice();
printf("Choose the StudID:");
scanf("%d",&go);getchar();
while(fread(&stud,sizeof(stud),1,fp))
{
if(!stud.recycle&&stud.studID==go)
{
sum++;
if(++once==1)
{ Y1=2;
gotoxy(X1,Y1);
printf("Name");
gotoxy(X1+9,Y1);
printf("Sex");
gotoxy(X1+(2*9),Y1);
printf("StudID");
gotoxy(X1+(3*9),Y1);
printf("ClassID");
gotoxy(X1+(4*9),Y1);
printf("English");
gotoxy(X1+(5*9),Y1);
printf("Math");
gotoxy(X1+(6*9),Y1);
printf("Computer");
gotoxy(X1,++Y1);
}
gotoxy(X1,Y1);clreol();
printf("%s",stud.name);
gotoxy(X1+9,Y1);
printf("%c",stud.sex);
gotoxy(X1+(2*9),Y1);
printf("%d",stud.studID);
gotoxy(X1+(3*9),Y1);
printf("%d",stud.classID);
gotoxy(X1+(4*9),Y1);
printf("%d",stud.english);
gotoxy(X1+(5*9),Y1);
printf("%d",stud.math);
gotoxy(X1+(6*9),Y1);
printf("%d",stud.computer);
gotoxy(X1,Y1+1);
printf("Do you want to insert before this record ?y/n");yn=getchar(); getchar();
if(yn=='n'||yn=='N')
{fwrite(&stud,sizeof(stud),1,temp);yn='s';}
else
{ temp2=stud;
gotoxy(X1,++Y1);clreol();/*return start position*/
gets(stud.name);gotoxy(X1+9,Y1);
stud.sex=getchar();getchar();gotoxy(X1+(2*9),Y1);
gets(numstr);stud.studID=atoi(numstr);gotoxy(X1+(3*9),Y1);
gets(numstr);stud.classID=atoi(numstr);gotoxy(X1+(4*9),Y1);
gets(numstr);stud.english=atoi(numstr);gotoxy(X1+(5*9),Y1);
gets(numstr);stud.math=atoi(numstr);gotoxy(X1+(6*9),Y1);
gets(numstr);stud.computer=atoi(numstr);printf("\n");
stud.recycle=0;
stud.total=stud.english+stud.computer+stud.math;
stud.average=(stud.total)/3;
fwrite(&stud,sizeof(stud),1,temp);
fwrite(&temp2,sizeof(stud),1,temp);
printf("Insert Successfully!!");
yn='s';
}
}
if(yn!='s')
{fwrite(&stud,sizeof(stud),1,temp);yn='';}
yn='';
}
if(!sum)
{printf("\nError!!Press any key return to Menu....");fclose(fp);fclose(temp);remove("temp.txt");getch();}
fclose(fp);
fclose(temp);
remove("RECORD");
rename("temp.txt","RECORD");
getch();
return;
}
/*Insert end*/

/*recycle start*/
void recycle(void)
{
int Y1=3,i=0,sum=0,once=1,i2=0;
FILE *fp;
cleardevice();
if((fp=(fopen("RECORD","rb")))==NULL)
{printf("I can not open this file.");getch();return;}
while(fread(&stud,sizeof(stud),1,fp)) sum++;
rewind(fp);
if(sum==0)
{printf("\nNo record in file.Pass any key return to Menu..");getch();return;}
while(fread(&stud,sizeof(stud),1,fp)==1)
{ if(once==1)
{Y1=2;
clrscr();
gotoxy(X2,Y1);
printf("Name");
gotoxy(X2+9,Y1);
printf("Sex");
gotoxy(X2+(2*9),Y1);
printf("StudID");
gotoxy(X2+(3*9),Y1);
printf("ClassID");
gotoxy(X2+(4*9),Y1);
printf("English");
gotoxy(X2+(5*9),Y1);
printf("Math");
gotoxy(X2+(6*9),Y1);
printf("Computer");
gotoxy(X2+(7*9),Y1);
printf("Total");
gotoxy(X2+(8*9),Y1++);
printf("Aver");
once=0;
}
if(stud.recycle)
{
gotoxy(X2,Y1);
printf("%s",stud.name);gotoxy(X2+(1*9),Y1);
printf("%c",stud.sex);gotoxy(X2+(2*9),Y1);
printf("%d",stud.studID);gotoxy(X2+(3*9),Y1);
printf("%d",stud.classID);gotoxy(X2+(4*9),Y1);
printf("%d",stud.english);gotoxy(X2+(5*9),Y1);
printf("%d",stud.math);gotoxy(X2+(6*9),Y1);
printf("%d",stud.computer);gotoxy(X2+(7*9),Y1);
printf("%d",stud.average);gotoxy(X2+(8*9),Y1);
printf("%d",stud.total);gotoxy(X2,++Y1);i2++;
}
if(++i==sum)
{printf("\nPress any key return to Menu.....");getch();break;}
if(sum>20&&i2!=0)
{if((i2%20)==0){printf("\nPress any key to continue.....");getch();once=1;i2=0;}}
}
fclose(fp);
return;
}
/*end recycle*/

/*Recovery start*/
void recovery(void)
{
int go,Y1=3,once=0,sum=0;
char numstr[20],yn='n';
FILE *fp,*temp;
temp=fopen("temp.txt","wb");
if((fp=(fopen("RECORD","rb")))==NULL)
{printf("I can not open this file.");getch();return;}
cleardevice();
printf("Choose the StudID:");
scanf("%d",&go);getchar();
while(fread(&stud,sizeof(stud),1,fp))
{
if(stud.recycle&&stud.studID==go)
{
sum++;
if(++once==1)
{ Y1=2;
gotoxy(X1,Y1);
printf("Name");
gotoxy(X1+9,Y1);
printf("Sex");
gotoxy(X1+(2*9),Y1);
printf("StudID");
gotoxy(X1+(3*9),Y1);
printf("ClassID");
gotoxy(X1+(4*9),Y1);
printf("English");
gotoxy(X1+(5*9),Y1);
printf("Math");
gotoxy(X1+(6*9),Y1);
printf("Computer");
gotoxy(X1,++Y1);
}
gotoxy(X1,Y1);clreol();
printf("%s",stud.name);
gotoxy(X1+9,Y1);
printf("%c",stud.sex);
gotoxy(X1+(2*9),Y1);
printf("%d",stud.studID);
gotoxy(X1+(3*9),Y1);
printf("%d",stud.classID);
gotoxy(X1+(4*9),Y1);
printf("%d",stud.english);
gotoxy(X1+(5*9),Y1);
printf("%d",stud.math);
gotoxy(X1+(6*9),Y1);
printf("%d",stud.computer);
gotoxy(X1,Y1+1);
printf("Do you want to Recovery this record?y/n");yn=getchar(); getchar();
if(yn=='n'||yn=='N')
{fwrite(&stud,sizeof(stud),1,temp);yn='s';}
else
{
gotoxy(X1,++Y1);clreol();/*return start position*/
stud.recycle=0;
fwrite(&stud,sizeof(stud),1,temp);yn='s';printf("Recovery Successfully!!");
}
}
if(yn!='s')
{fwrite(&stud,sizeof(stud),1,temp);yn='';}
yn='';
}
if(!sum)
{printf("\nPress any key return to Menu....");fclose(fp);fclose(temp);remove("temp.txt");getch();return;}
fclose(fp);
fclose(temp);
remove("RECORD");
rename("temp.txt","RECORD");
getch();
return;
}
/*Recovery end*/

/*Delete complete. start*/
void realdel(void)
{
int go,Y1=3,once=0,sum=0;
char numstr[20],yn='n';
FILE *fp,*temp;
temp=fopen("temp.txt","wb");
if((fp=(fopen("RECORD","rb")))==NULL)
{printf("I can not open this file.");getch();return;}
cleardevice();
printf("Choose the StudID:");
scanf("%d",&go);getchar();
while(fread(&stud,sizeof(stud),1,fp))
{
if(stud.recycle&&stud.studID==go)
{
sum++;
if(++once==1)
{ Y1=2;
gotoxy(X1,Y1);
printf("Name");
gotoxy(X1+9,Y1);
printf("Sex");
gotoxy(X1+(2*9),Y1);
printf("StudID");
gotoxy(X1+(3*9),Y1);
printf("ClassID");
gotoxy(X1+(4*9),Y1);
printf("English");
gotoxy(X1+(5*9),Y1);
printf("Math");
gotoxy(X1+(6*9),Y1);
printf("Computer");
gotoxy(X1,++Y1);
}
gotoxy(X1,Y1);clreol();
printf("%s",stud.name);
gotoxy(X1+9,Y1);
printf("%c",stud.sex);
gotoxy(X1+(2*9),Y1);
printf("%d",stud.studID);
gotoxy(X1+(3*9),Y1);
printf("%d",stud.classID);
gotoxy(X1+(4*9),Y1);
printf("%d",stud.english);
gotoxy(X1+(5*9),Y1);
printf("%d",stud.math);
gotoxy(X1+(6*9),Y1);
printf("%d",stud.computer);
printf("\nDo you want to Delete complete this record?y/n");yn=getchar(); getchar();
if(yn=='n'||yn=='N')
{fwrite(&stud,sizeof(stud),1,temp);yn='s';}
else
{
gotoxy(X1,++Y1);clreol();/*return start position*/
yn='s';printf("Delete completed Successfully!!");
}
}
if(yn!='s')
{fwrite(&stud,sizeof(stud),1,temp);yn='';}
yn='';
}
if(!sum)
{printf("\nPress any key return to Menu....");}
fclose(fp);
fclose(temp);
remove("RECORD");
rename("temp.txt","RECORD");
getch();
return;
}
/*Delete complete end*/

/*statistics start*/
void statistics(void)
{
int all_pass=0,com_pass=0,math_pass=0,good=0,member=0,en_pass=0;
float en_aver=0.0,com_aver=0.0,math_aver=0.0,all_aver=0.0;
float total=0.0;
FILE *fp;
cleardevice();
if((fp=(fopen("RECORD","rb")))==NULL)
{printf("I can not open this file.");getch();return;}
while(fread(&stud,sizeof(stud),1,fp)){if(!stud.recycle)member++;}
rewind(fp);
while(fread(&stud,sizeof(stud),1,fp)) { if(stud.english>=60||!stud.recycle)en_pass++; }rew