#include
#include
#include
#include
#define SIZE 100
#define STUD
"%-10s%-20sdddn",stud[i].num,stud[i].name,stud[i].score[0],stud[i].sc
ore[1],stud[i].score[2]
struct student_type
{
char num[15];
char name[20];
int score[3];
}stud[SIZE];
struct student_typeread
{
};
char num[15];
char name[20];
char score[3][10];
typedef struct node
{
char num[15];
char name[20];
int score[3];
struct node *link;
}HNode;
int n;
void student();
void teacher();
void alldata();
void enter();
void addone();
void delete();
void change();
int num_search();
void heapsort();
void sift(struct student_type stud[],int t,int index,int w);
void courtscores();
int chartoint(char *c);
int numcheck(char *num);
int namecheck(char *name);
int getcount();
int inistud();
int h(int k);
int creatail_score(HNode *t[],struct student_type stud[],int index,int
n);
int Query_a_record_by_score(HNode *t[],struct student_type stud[],int
n);
int writestud(FILE *fp,struct student_type stu);
main()
{
mainmenu:
int c;
clrscr();
printf("**************************MAIN
MENU*****************************n");
printf("
your choice(1-3):n");
printf("
printf("
printf("
printf("
eachern");
tudentn");
isitorn");
uitn");
please make
1.t
2.s
3.v
4.q
printf("************************************************
*****************n");
printf("ttt
please input your choose(1-4):");
scanf("%d",&c);
clrscr();
for( ; ; )
{
{
switch(c)
case 1:
teacher();goto mainmenu;
case 2:
student();goto mainmenu;
case 3:
num_search();clrscr();goto
case 4:
exit(0);
default : printf("data
mainmenu;
error.n");getchar();return;
}
}
}
void teacher()
{
int c;
char p[6];
clrscr();
printf("input your password:n");
scanf("%s",p);
while(strcmp(p,"123456")!=0 )
printf("password error,input again:n");
scanf("%s",p);
{
}
for( ; ; )
{
clrscr();
printf("**************************TEACHER'S
MENU******
***********************n");
printf("
your choice(1-3):n");
printf("
recordsn");
printf("
record from filen");
printf("
to filen");
printf("
different scoresn");
scoresn");
printf("
printf("
record from the filen");
printf("
printf("
datasn");
page.n");
please make
1.enter the
2.delete a
3.add record
4.heapsort by
5.count by
6.change the
7.check all
8.return main
printf("************************************************
***********n");
printf("ttt
please input your choose(1-8):");
scanf("%d",&c);
clrscr();
switch(c)
{
case 1:
enter();break;
case 2:
delete();break;
case 3:
addone();break;
case 4:
heapsort();break;
case
case 6:
change();break;
case 7:
alldata();break;
case 8:
return;
default : printf("data
}
5:
courtscores();break;
error.n");
}
}
void student()
{
int c;HNode *t[SIZE]={0};int n;
char p[6];
clrscr();
printf("input your password:n");
scanf("%s",p);
while(strcmp(p,"888888")!=0 )
printf("password error,input again:n");
scanf("%s",p);
{
}
for( ; ; )
{
clrscr();
printf("**************************STUDENT'S
MENU******
***********************n");
printf("
your choice(1-3):n");
printf("
records by numbern");
printf("
scoresn");
printf("
records by scoresn");
printf("
page.n");
please make
1.search the
2.sort by
3.search the
4.return main
printf("************************************************
***********n");
printf("ttt
please input your choose(1-4):");
scanf("%d",&c);
clrscr();
switch(c)
{case 1: num_search();break;
case 2: heapsort();break;
inistud();n=getcount();Query_a_record_by_score(t,stud,n);break;
case 3:
case 4: return;
default:printf("data error.n");
}
}
}
void enter()
{
char *s;
int i,m,j,k;
FILE *fp;
clrscr();
printf("nplease input num you want to input(1-100):n");
scanf("%d",&n);
for( ; ;)