Structure teacher
{
char t _ name[20];
int t _ age
char t _ job[20];
char t _ job place[20];
struct Teacher * next
};
Structural students
{
char s _ name[20];
int s _ age
char s _ zhuan ye[30];
int s _ class
Structural students * next;
}; //saved in the Teacher.h file.
# include & ltstdio.h & gt
# include & ltstring.h & gt
# contains "Teacher.h"
External character operation;
External char operate _ object
extern int s _ flag
extern int t _ flag
Teacher, teacher;
Teacher * T;;
Teacher * nt
Students, students;
Students';
Student * ns
Enter ()
{
flush all();
extern Operate();
//printf("%c ",operate);
Printf ("Please select the object you need to manipulate \ n");
Printf ("student teacher (t) \ n");
scanf("%c ",& ampoperate _ object);
//printf("%c\n ",operate _ object);
Switch (operate_object)
{
Case:
s _ flag++;
flush all();
Printf ("\ nPlease enter student name:");
Scanf("%s ",& student. s _ name);
Printf ("\ nPlease enter the age of the student:");
scanf("%d ",& ampstudent . s _ age);
Printf ("\ nPlease enter the student's major:");
scanf("%s ",& ampstudent . s _ zhuan ye);
Printf ("\ nPlease enter student class:");
scanf("%d ",& ampstudent . s _ class);
Ns = (student *)malloc(sizeof));
strcpy(ns-& gt; s_name,student . s _ name);
ns-& gt; s _ age = student.s _ age
strcpy(ns-& gt; s_zhuanye,student . s _ zhuan ye);
ns-& gt; s _ class = student.s _ class
ns-& gt; next = S-& gt; Next;
s-& gt; next = ns
operate();
Break;
Case:
s _ flag++;
flush all();
Printf ("\ nPlease enter student name:");
Scanf("%s ",& student. s _ name);
Printf ("\ nPlease enter the age of the student:");
scanf("%d ",& ampstudent . s _ age);
Printf ("\ nPlease enter the student's major:");
scanf("%s ",& ampstudent . s _ zhuan ye);
Printf ("\ nPlease enter student class:");
scanf("%d ",& ampstudent . s _ class);
Ns = (student *)malloc(sizeof));
strcpy(ns-& gt; s_name,student . s _ name);
ns-& gt; s _ age = student.s _ age
strcpy(ns-& gt; s_zhuanye,student . s _ zhuan ye);
ns-& gt; s _ class = student.s _ class
ns-& gt; next = S-& gt; Next;
s-& gt; next = ns
operate();
Break;
Case "t":
t _ flag++;
flush all();
Printf ("\ nPlease enter teacher's name:");
scanf("%s ",& ampteacher . t _ name);
Printf ("\ nPlease enter the age of the teacher:");
scanf("%d ",& ampteacher . t _ age);
Printf ("\ nPlease enter the course taught by the teacher:");
Scanf("%s ",& teacher. t _ job);
Printf ("\ nPlease enter the teacher's office:");
scanf("%s ",& ampteacher . t _ jobPlace);
Nt = (teacher *)malloc(sizeof));
strcpy(nt-& gt; t_name,teacher . t _ name);
nt-& gt; t _ age = teacher.t _ age
strcpy(nt-& gt; t_job,teacher . t _ job);
strcpy(nt-& gt; t_jobPlace,teacher . t _ job place);
nt-& gt; next = T-& gt; Next;
t->; next = nt
operate();
Break;
Case "t":
t _ flag++;
flush all();
Printf ("\ nPlease enter teacher's name:");
scanf("%s ",& ampteacher . t _ name);
Printf ("\ nPlease enter the age of the teacher:");
scanf("%d ",& ampteacher . t _ age);
Printf ("\ nPlease enter the course taught by the teacher:");
Scanf("%s ",& teacher. t _ job);
Printf ("\ nPlease enter the teacher's office:");
scanf("%s ",& ampteacher . t _ jobPlace);
Nt = (teacher *)malloc(sizeof));
strcpy(nt-& gt; t_name,teacher . t _ name);
nt-& gt; t _ age = teacher.t _ age
strcpy(nt-& gt; t_job,teacher . t _ job);
strcpy(nt-& gt; t_jobPlace,teacher . t _ job place);
nt-& gt; next = T-& gt; Next;
t->; next = nt
operate();
Break;
Default value:
Printf ("The operand you entered is illegal, please re-enter \ n");
input();
Break;
}
}//saved in the Input.h file for input operation.
# include & ltstdio.h & gt
# contains "Input.h"
extern Operate();
External character operation;
External char operate _ object
extern int s _ flag
extern int t _ flag
Teacher extern * T;;
Day students;
Structure Student * S _ node
Structural students * s1;
Teacher struct * t1;
Teacher struct * T _ node
Output ()
{
flush all();
External input ();
Printf ("Please enter the object to operate \ n");
Printf(" \ n student teacher (t) \ n ");
scanf("%c ",& ampoperate _ object);
if(operate _ object = = ' S ' | | operate _ object = = ' S ')
{
flush all();
if(s_flag! = 0)
{
while(S_node! = empty)
{
printf("%s,%d,%s,%d\n ",s 1-& gt; Next-> s_name,s 1-& gt; Next-> s_age,s 1-& gt; Next-> s_zhuanye,s 1->; Next-> s _ class);
s 1 = s 1->; Next;
s _ node = s 1-& gt; Next;
}
Printf ("\ nOutput completed \ n");
operate();
}
other
{
Printf ("\ nThere is nothing to output, please do something else \ n");
operate();
}
}
if(operate _ object = = ' T ' | | operate _ object = = ' T ')
{
flush all();
if(t_flag! = 0)
{
while(T_node! = empty)
{
printf("%s,%d,%s,%s\n ",t 1-& gt; Next-> t_name,t 1-& gt; Next-> t_age,t 1->; Next-> t_job,t 1-& gt; Next-> t _ job place);
t 1 = t 1->; Next;
t _ node = t 1-& gt; Next;
}
}
other
{
Printf ("\ nThere is nothing to output, please do something else \ n");
operate();
}
}
}
//Save it in the Output.h file for output operation.
# include & ltstdio.h & gt
# include & ltstring.h & gt
# contains "Search.h"
char operate = ' s
char operate _ object = ' s
int s _ flag = 0;
int t _ flag = 0;
External output ();
External search ();
//extern Delete();
Teacher extern * T;;
Day students;
Teacher extern * nt
Day students;
Operation ()
{
flush all();
char q _ sure
Printf ("\ nPlease select what you need to do \ n");
Printf(" i or i stands for input operation \ n ");
Printf(" o or o stands for output operation \ n ");
Printf(" s or s stands for query operation \ n ");
Printf(" d or d stands for delete operation \ n ");
Printf(" q or q stands for exit operation \ n \ n ");
Scanf("%c ",& operation);
//printf("%d, %d ",& operation & operate _ object);
Switch (operation)
{
Case "I":
flush all();
input();
Break;
Case "I":
flush all();
input();
Break;
Case "o":
flush all();
output();
Break;
Case "o":
flush all();
output();
Break;
Case:
flush all();
search();
Break;
Case:
flush all();
search();
Break;
Case "d":
flush all();
//Delete();
Break;
Case "d":
flush all();
//Delete();
Break;
Case "q":
flush all();
Printf ("\ nAre you sure you want to quit? \ n ");
printf(" \ N confirm(y)Cancel(N)\ N ");
scanf("%c ",& ampq _ sure);
if(q_sure == 'Y' || q_sure == 'y ')
{
Break;
}
if(q_sure == 'N' || q_sure == 'n ')
{
operate();
}
Case "q":
flush all();
Printf ("\ nAre you sure you want to quit? \ n ");
printf(" \ N confirm(y)Cancel(N)\ N ");
scanf("%c ",& ampq _ sure);
if(q_sure == 'Y' || q_sure == 'y ')
{
Break;
}
if(q_sure == 'N' || q_sure == 'n ')
{
operate();
}
Break;
Default value:
Printf ("The operand you entered is illegal, please re-enter \ n");
operate();
Break;
}
}
//Save it in the Operate.h file to select the operation to be performed.