Home > Back-end >  Pray god to solve a small problem
Pray god to solve a small problem

Time:10-02

//I guess should be in the main function, the input values of n n is fixed, cause each loop is executed case 1, I want to enter a break after the student information, return to the main menu interface to choose, but could you tell me how to change?
#include
#include
#include



Struct Member
{
Char number [10].
Char name [10].
Char gender [10].
Int birth;
Char yuanxi [10].
Char zhiwu [10].
Int sushehao;
Int phonenumber.

};
Struct Member lib [10].
Int num=0;
Int the display (char [] s);
Void delete_member ();
Void jiemian ();
Void the sort ();
Void jiemian ();



Void jiemian ()
{

Printf (" simple community management system \ n ");
Printf (" select want to operate: \ n ");
Printf (" 1 2 delete student information to add student information change 3 student information to find students information 5 shows students exit 6 \ n ");


}





Void rush (struct Member lib [])//new members into the club
{
Int I=num;
While (1)
{
Printf (" please enter the first % d classmate information \ n ", I + 1);
Printf (" please enter the student id: ");
The scanf (" % s ", lib [I] number);

Printf (" please input your name: ");
The scanf (" % s ", lib [I] name);

Printf (" please enter the gender: ");
The scanf (" % s ", lib [I] gender);

Printf (" please enter the birthday: ");
The scanf (" % d ", & amp; Lib [I] birth);

Printf (" please input departments: ");
The scanf (" % s ", lib [I] yuanxi);

Printf (" please enter the officers: ");
The scanf (" % s ", lib [I] zhiwu);

Printf (" please enter the dorm number: ");
The scanf (" % d ", & amp; Lib [I] sushehao);

Printf (" please enter the phone number: ");
The scanf (" % d ", & amp; Lib [I] phonenumber);

i++;
}
Printf (" has the information input % d a classmate \ n ", num);


}

Void the sort ()//student id by the
{
Int I, j;
Struct Member temp.
for(j=0; Jfor(i=1; IIf (lib [I] number{
Temp=lib [I];
Lib [I]=lib [I + 1);
Lib [I + 1)=temp;
}





Printf (" sorted results for: \ n ");
for(i=0; I{
Printf (" this classmate student id: % s ", lib [I] number);
printf("\n");
Printf (" this classmate name: % s ", lib [I] name);
printf("\n");
Printf (" this classmate gender: % s ", lib [I] gender);
printf("\n");
Printf (" the classmate birthday: % d ", lib [I] birth);
printf("\n");
Printf (" this classmate departments: % s ", lib [I] yuanxi);
printf("\n");
Printf (" this classmate position: % s ", lib [I] zhiwu);
printf("\n");
Printf (" the student dormitory number: % d ", lib [I] sushehao);
printf("\n");
Printf (" the classmate telephone number: % d ", lib [I] phonenumber);
printf("\n");
}

}


Void delete_member ()//delete
{
Int I=1, j;
Char s [20];
Printf (" input to delete the classmate student number: ");
The scanf (" % s ", & amp; S);
J=the display (s);
If (j!=1)
{
for(i=1; I{
Lib [I]=lib [I + 1);
}
Printf (" deleted ");

}

}

Void the modify ()
{
int j;
Char s [20];
Printf (" please enter the need to modify the students student id ");
The scanf (" % s ", s);
J=the display (s);
If (j!=1);
{
Printf (" \ n \ n please re-enter the student information ");
Printf (" \ n please enter student id: ");
The scanf (" % s ", lib [j]. Journal of number);
Printf (" modify name: ");
The scanf (" % s ", lib [j]. Name);
Printf (" please enter the gender: ");
The scanf (" % s ", lib [j]. Journal of gender);
Printf (" please enter the birthday: ");
The scanf (" % d ", & amp; Lib [j]. Journal of birth);
Printf (" please input departments: ");
The scanf (" % s ", lib [j]. J yuanxi);
Printf (" please enter the officers: ");
The scanf (" % s ", lib [j]. Zhiwu);
Printf (" please enter the dorm number: ");
The scanf (" % d ", & amp; Lib [j] sushehao);
Printf (" please enter the phone number: ");
The scanf (" % d ", & amp; Lib [j] phonenumber);
}
}


Int the display (char [] s)
{
Int k=1, I;
If (strlen (s)==0)
{
If (num> 0)
{
for(i=0; I{
Printf (" this classmate student id: % s ", lib [I] number);
printf("\n");
Printf (" this classmate name: % s ", lib [I] name);
printf("\n");
Printf (" this classmate gender: % s ", lib [I] gender);
printf("\n");
Printf (" the classmate birthday: % d ", lib [I] birth);
printf("\n");
Printf (" this classmate departments: % s ", lib [I] yuanxi);
printf("\n");
Printf (" this classmate position: % s ", lib [I] zhiwu);
printf("\n");
Printf (" the student dormitory number: % d ", lib [I] sushehao);
printf("\n");
Printf (" the classmate telephone number: % d ", lib [I] phonenumber);
printf("\n");
}
}
The else
Printf (" student information ");



}
The else
{
for(i=0; IIf (STRCMP (s, lib [I] number)==0)
{
Printf (" the classmate student id: % d ", lib [I] number);
printf("\n");
Printf (" this classmate name: % s ", lib [I] name);
printf("\n");
Printf (" this classmate gender: % s ", lib [I] gender);
printf("\n");
Printf (" the classmate birthday: % d ", lib [I] birth);
printf("\n");
Printf (" this classmate departments: % s ", lib [I] yuanxi);
printf("\n");
Printf (" this classmate position: % s ", lib [I] zhiwu);
printf("\n");
Printf (" the student dormitory number: % d ", lib [I] sushehao);
printf("\n");
Printf (" the classmate telephone number: % d ", lib [I] phonenumber);
printf("\n");
K=I;
}

If (k==1)
Printf (" could not find the student ");


}

The return of k;
}//return k=1 is wrong, otherwise the returned array subscript



Void search (struct Member lib [])//in accordance with the student id to find
{

Char s [20];
Printf (" please enter the classmate student id ");
The scanf (" % s ", & amp; S);
The display (s);

}




The main ()
{

int n;

System (" CLS ");

For (;; )
{
Jiemian ();
Printf (" input option number ");
The scanf (" % d ", & amp; N);
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related