# include & ltstring.h & gt
Structural students
{
Long integer;
char name[20];
int age
char sex[4];
char b[30];
char p[ 15];
};
int n = 0;
Stu, a structural student [100];
struct student * p;
void lr();
void ll();
void CX();
void XG();
void sc();
void main()
{
int z;
printf("+-+\ n ");
Printf("| Welcome to Student Information Management System | \ n ");
printf("+-+\ n ");
Printf ("Tip: To ensure that your operations are saved, please exit the system in normal order _ \ n");
do
{
printf(" \ n \ t \ t \ t-\ n ");
printf(" \ t \ t+main menu | \ n ");
printf(" \ t \ t \ t-\ n ");
Printf(" \ t \ t+[ 1]- Enter student information | \ n ");
Printf(" \ t \ t+[2]- browse student information | \ n ");
Printf(" \ t \ t+[3]- query student information | \ n ");
Printf(" \ t \ t+[4]- Delete student information | \ n ");
Printf(" \ t \ t+[5]- Modify student information | \ n ");
Printf(" \ t \ t+[0]- Exit the system | \ n ");
printf(" \ t \ t \ t-\ n ");
Printf ("Please enter your choice:");
scanf("%d ",& ampz);
Switch (z)
{
Case 0: broken;
Case1:lr (); Break;
Case 2: ll (); Break;
Case 3: CX (); Break;
Case 4: SC (); Break;
Case 5: XG (); Break;
Default value: printf ("\ nInvalid option!" );
}
}
And (z! = 0);
}
Void lr()/* Input function */
{
int y;
If (n==0)
p = stu
do
{
printf("-\ n ");
Printf ("Please enter your student number:");
scanf("%ld ",& ampp->; num);
Printf ("Please enter student name:");
scanf("%s ",p-& gt; Name);
Printf ("Please enter student's age:");
scanf("%d ",& ampp->; Age);
Printf ("Please enter student gender:");
scanf("%s ",p-& gt; Sex);
Printf ("Please enter student address:");
scanf("%s ",p-& gt; b);
Printf ("Please enter the phone number of the student:");
scanf("%s ",p-& gt; p);
n++;
p++;
Printf("\n 1。 Keep typing. \n0。 Input is complete. \ n ");
Printf ("Please select:");
scanf("%d ",& ampy);
}
while(y = = 1);
Printf ("Hint: Input finished! You enter %d \n ",n" once * *, n);
}
Void ll()/* browse function */
{
int i,j;
If (n! =0)
{printf ("Total number of students: %d\n", n);
Printf ("Student ID \ tName \ t \ tAge \ tSex \ Address \ t \ tPhone \ n");
printf("-\ n ");
for(I = 0; I & ltn;; i++)
printf(" % LD \ t % s \ t % d \ t % s \ t % s \ t % s \ t \ t % s \ n ",stu[i]。 num,stu[i]。 Name, Stu [me]. Age, Stu [me]. Sex, Stu [me]. B, Stu [me]. p);
}
Else printf ("hint: there is no student data, please enter data!") ) );
}
Void cx()/* Query function */
{
int c;
int w,I,j = 0;
char name[20];
If (n! =0)
{
do { printf(" \ n ");
printf("+-+\ n ");
Printf("| Please press 1 |\n "to query by student number);
Printf("| Press 2 to query by name | \ n ");
Printf("| Press 0 to cancel | \ n ");
printf("+-+\ n ");
Printf ("Please enter your choice:");
scanf("%d ",& ampc);
Switch (c)
{
Case 0: broken;
Case 1:
Printf ("Please enter student ID;" );
scanf("%ld ",& ampw);
printf(" \ n ");
for(I = 0; I & ltn;; i++)
If (Stu [I]. Quantity ==w)
{
Printf ("\ nStudent ID \ tname \ t \ tage \ tsex \ taddress \ t \ tphone \ n");
printf(" % LD \ t % s \ t % d \ t % s \ t % s \ t % s \ t \ t % s \ n ",stu[i]。 num,stu[i]。 Name, Stu [me]. Age, Stu [me]. Sex, Stu [me]. B, Stu [me]. p);
j = 1;
}
If (j==0)
Printf ("hint: there is no record of this student, please check it!") ) );
Break;
Case 2:
Printf ("Please enter student name:");
Scanf("%s ",name);
printf(" \ n ");
for(I = 0; I & ltn;; i++)
if(strcmp(name,stu[i].name)==0)
{
Printf ("\ nStudent ID \ tname \ t \ tage \ tsex \ taddress \ t \ tphone \ n");
j = 1;
printf(" % LD \ t % s \ t % d \ t % s \ t % s \ t % s \ t \ t % s \ n ",stu[i]。 num,stu[i]。 Name, Stu [me]. Age, Stu [me]. Sex, Stu [me]. B, Stu [me]. p);
}
If (j==0)
Printf ("hint: there is no record of this student, please check it!") ) );
Break;
Default value:
Printf ("\ nHint: Invalid option!" );
Break;
}
}while(c! = 0);
}else printf ("Hint: No student data, please enter data!" );
Return;
}
Void xg()/* Modify function */
{
Long integer;
int i,j,c;
If (n! =0)
{
Printf ("Please enter the student ID of the student you want to modify:");
scanf("%ld ",& ampnum);
printf(" \ n ");
for(I = 0; I & ltn;; i++)
If (Stu [I]. Number = = number)
j = I;
Do {
Printf ("Please select the information content of the student you want to modify: \ n");
printf("+-+\ n ");
printf(" | press 1 for name | \ n ");
Printf("| press 2 for age | \ n ");
Printf("| Press 3 for gender | \ n ");
Printf("| Student ID press 4 | \ n ");
Printf("| Press 5 to select an address | \ n ");
Printf("| Press 6 to connect | \ n ");
Printf("| Press 0 to cancel | \ n ");
printf("+-+\ n ");
Printf ("Please enter your choice:");
scanf("%d ",& ampc);
printf(" \ n ");
Switch (c)
{
Case 0: broken;
Case 1:printf ("Please enter a new name:");
Scanf("%s ",stu[j]. Name);
Break;
Case 2: printf ("Please enter a new era:");
Scanf("%d ",& stu [j]. Age);
Break;
Case 3: printf ("Please enter a new gender:");
Scanf("%s ",stu[j]. Sex);
Break;
Case 4: printf ("Please enter a new student number:");
Scanf("%ld ",& Stu [j]. num);
Break;
Case 5: printf ("Please enter a new address:");
scanf("%s ",stu[j].b);
Break;
Case 6:printf ("Please enter a new phone number:");
scanf("%s ",stu[j].p);
Break;
Default value:
Printf ("\ nInvalid option!" );
Break;
}
}while(c! = 0);
}else printf ("Hint: No student data, please enter data!" );
}
Void sc()/* Delete function */
{
Long integer;
int i,j,e;
If (n! =0)
{
Printf ("Student ID \ tName \ t \ tAge \ tSex \ Address \ t \ tPhone \ n");
printf("-\ n ");
for(I = 0; I & ltn;; i++)
printf(" % LD \ t % s \ t % d \ t % s \ t % s \ t % s \ t \ t % s \ n ",stu[i]。 num,stu[i]。 Name, Stu [me]. Age, Stu [me]. Sex, Stu [me]. B, Stu [me]. p);
Printf ("Please enter the student ID of the student you want to delete:");
scanf("%ld ",& ampnum);
printf(" \ n ");
for(I = 0; I & ltn;; i++)
if(num==stu[i])。 Numbers)
j = I;
If (j! =(n- 1))
{
for(e = I- 1; e & ltn; e++、j++)
{
Stu [j]. num=stu[j+ 1]。 num
Strcpy(stu[j]. Name, Stu [j+ 1]. Name);
Strcpy(stu[j]. Sex, Stu [j+ 1]. Sex);
Stu [j]. Age =stu[j+ 1]. Age;
strcpy(stu[j].b,stu[j+ 1]。 b);
strcpy(stu[j].p,stu[j+ 1]。 p);
n-; p-;
}
} else { n-; p-; }
Printf ("Hint: deletion completed!" ) );
}else printf ("Hint: No student data, please enter data!" );
}