Home > Back-end >  Pray god help look at this section of the program, the problem in the question mark in the program
Pray god help look at this section of the program, the problem in the question mark in the program

Time:09-16

#include
#include
#include

# define N 3

Int k;

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

};





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 \ n ");


}





Int rush (struct Member lib [])//new members into the club
{
Int I=1, k=0, a=1, b;//k is used to record data, total lib [0] left blank, starting from 1
The begin: the if (a=1)
{
Printf (" please enter the student id: ");
The scanf (" % d ", & amp; Lib [I] number);

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

Printf (" please enter the gender: ");
The scanf (" % s ", & amp; Lib [I]. Gender);

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

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

Printf (" please enter the officers: ");
The scanf (" % s ", & amp; 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);

Printf (" press 1, continue to input end press 0 \ n ");//control the amount of input data
The scanf (" % d ", & amp; B);

k++;
i++;

The return of k;
If (b==1)
Goto the begin.
The else break;//how to control jump out to the interface, through input 0 break an error?

}

}
//must be input N information didn't stop

Int delete_member (struct Member lib [])//delete
{
Int I=1, j;
Char a, [10].
Printf (" input to delete the classmate's name: ");
The scanf (" % s ", & amp; A);
While (STRCMP (lib [I]. Name, a).=0) i++;
//if (I=k + 1) printf (" no such person ");

For (j=I; I<=k; I++)
{
Strcpy (lib [j]. Journal of number, lib [j + 1] number);//warning C4047: 'function' : 'char *' differs in levels of indirection from 'int'
Strcpy (lib [j]. Name, lib [j + 1] name);//the company types for formal and actual parameter 1
Strcpy (lib [j]. Journal of gender, lib [j + 1] gender);
Strcpy (lib [j]. Journal of birth, lib [j + 1] birth);
Strcpy (lib [j] yuanxi, lib [j + 1] yuanxi);
Strcpy (lib [j]. Zhiwu, lib [j + 1] zhiwu);
Strcpy (lib [j] sushehao, lib [j + 1] sushehao);
Strcpy (lib [j] phonenumber, lib [j + 1] phonenumber); Why//an error?
}
Printf (" has been deleted, press 1 to return to the interface ");

Return (k - 1);

}


Void the display (struct Member lib [])
{
int i;
I=k;
Printf (" the classmate student id: % d ", & amp; Lib [I] number);
printf("\n");
Printf (" this classmate name: % s ", & amp; Lib [I] name);
printf("\n");
Printf (" this classmate gender: % s ", & amp; Lib [I]. Gender);
printf("\n");
Printf (" the classmate birthday: % d ", & amp; Lib [I] birth);
printf("\n");
Printf (" this classmate departments: % s ", & amp; Lib [I] yuanxi);
printf("\n");
Printf (" this classmate position: % s ", & amp; Lib [I]. Zhiwu);
printf("\n");
Printf (" the student dormitory number: % d ", & amp; Lib [I] sushehao);
printf("\n");
Printf (" the classmate telephone number: % d ", & amp; Lib [I] phonenumber);
printf("\n");
}

/*
Int search (struct Member lib [])
{
int i;
Char s [10];
for(i=1; I<=N; I++)
{
While (STRCMP (lib [I]. Name, s)!=0)
break;

}
Return the I;

}//may function with the following function overlap */

Void searchname (struct Member lib [])//by name lookup
{
int i;
Char s [10];
Printf (" please enter the class name ");
The scanf (" % s ", & amp; s);
For (I=1; I<=N; I++)
{
If (STRCMP (lib [I]. Name, s)==0)
The display (lib [I]);
//return the I;//return find array subscript


}
//if () printf (" no information ");//no matter how will perform this step, how to perform this step in didn't find?




}

//void search_num ()


The main ()
{
Int n, a;
Struct Member lib [10].
The system (" CLS ");
Jiemian ();
Printf (" input option number ");
The scanf (" % d ", & amp; N);
while(n!=EOF& & N> 0 & amp; & n<5)
{
The switch (n)
{
Case 1:
{
Rush (lib);
break;

}
Case 2:
{
Delete_member (lib);
break;
}
Case 4:
{
Searchname (lib);
break;
}

}


}
Printf (" continue to enter please press 1, return to the interface, please press 0 ");
The scanf (" % d ", & amp; A);
If (a=1)

Goto the begin.//every step after the execution back to the main interface
}

CodePudding user response:


Int rush (struct Member lib [])//new members into the club
{
Int I=1, k=0, a=1, b;//k is used to record data, total lib [0] left blank, starting from 1
The begin:
If ( a=1 //here is===still
{
Printf (" please enter the student id: ");
The scanf (" % d ", & amp; Lib [I] number);

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

Printf (" please enter the gender: ");
the scanf (" % s ", & amp; Lib [I]. Gender);//char is to use % s format specified input? And what % c

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

Printf (" please input departments: ");
the scanf (" % s ", & amp; Lib [I] yuanxi);

Printf (" please enter the officers: ");
the scanf (" % s ", & amp; Lib [I]. Zhiwu);

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

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related