includestring.h
includestdio.h
includestdlib.h
includemalloc.h
define NULL 0
typedef struct lianxiren
char job30;
char number20;
char name10;
char email30;
struct lianxirennext;
lianxiren;
define LEN sizeoflianxiren
lianxiren creatlist
lianxiren head,p1,p2;
char name10;int n0;
headNULL;
p1lianxiren mallocLEN;
p2p1;
printf0:;
getsname;
ifstrcmpname,00return 0;
else
strcpyp1name,name;
printf:;getsp1number;
printf:;getsp1job;
printfEmail:;getsp1email;
while1
n;
ifn1
headp1;
else
p2nextp1;
p2p1;
printf0:;
getsname;
ifstrcmpname,00break;
else
p1lianxirenmallocLEN;
strcpyp1name,name;
printf:;getsp1number;
printf:;getsp1job;
printfEmail:;getsp1email;
p2nextNULL;
return head;
lianxiren shifanglistlianxirenhead
lianxirenp1;
for;head!NULL;
p1head;
headheadnext;
freep1;
return head;
void printlistlianxirenhead
void caidan;
int n0;
printf:;
whilehead!NULL
printfn:;putsheadname;
printfn:;putsheadnumber;
printfn:;putsheadjob;
printfnEmail:;putsheademail;
putcharn;
headheadnext;n;
ifn80
printf;
getchar;
systemcls;
caidan;
printfdn,n;
int lengthlianxirenhead
int n0;
lianxiren p;
phead;
whilep ! NULL
ppnext;
n;
return n;
void paixu1lianxirenhead
void caidan;
int nlengthhead;
int i,j;
lianxiren temp,p;
phead;
lianxiren a100;
fori1;in;i
strcpyai.name,pname;
strcpyai.number,pnumber;
strcpyai.job,pjob;
strcpyai.email,pemail;
ppnext;
fori1;in1;i
forj1;jni;j
ifstrcmpaj.number,aj1.number0
tempaj;
ajaj1;
aj1temp;
printf:;
fori1;in;i
printfn:;putsai.name;
printfn:;putsai.number;
printfn:;putsai.job;
printfnEmail:;putsai.email;
putcharn;
ifi80
printf;
getchar;
systemcls;
caidan;
printfdn,n;
void paixu2lianxirenhead
void caidan;
int nlengthhead;int i,j;
lianxiren temp,p;
phead;
lianxiren a100;
fori1;in;i
strcpyai.name,pname;
strcpyai.number,pnumber;
strcpyai.job,pjob;
strcpyai.email,pemail;
ppnext;
fori1;in1;i
forj1;jni;j
ifstrcmpaj.name,aj1.name0
tempaj;
ajaj1;
aj1temp;
printf:;
fori1;in;i
printfn:;putsai.name;
printfn:;putsai.number;
printfn:;putsai.job;
printfnEmail:;putsai.email;
putcharn;
ifi80
printf;
getchar;
systemcls;
caidan;
printfdn,n;
void paixulistlianxirenhead
void caidan;
ifheadNULL
printf!;
return;
char a;
printf1,n2,n;
printf:;
agetchar;
getchar;
switcha
case1:paixu1head;break;
case2:paixu2head;break;
default:printf!n;break;
void chazhao1lianxirenhead
ifheadNULL
printf;
return;
char name10;
printf:;getsname;
whilestrcmpname,headname!0
headheadnext;
ifheadNULLprintfn;
return;
printfs:,name;
putsheadnumber;
printfn:;putsheadjob;
printfnEmail:;putsheademail;
void chazhao2lianxirenhead
ifheadNULL
printf;
return;
char number20;
printf:;getsnumber;
whilestrcmpnumber,headnumber!0
headheadnext;
ifheadNULLprintfn;
return;
printfs:,number;
putsheadname;
printfn:;putsheadjob;
printfnEmail:;putsheademail;
void chazhaolianxirenhead
int n;
printf 1,n 2,n 3,n:;
scanfd,n;
getchar;
while1
switchn
case 1:chazhao1head;printf:;scanfd,n;getchar;break;
case 2:chazhao2head;printf:;scanfd,n;getchar;break;
case 3:return;break;
default:printf!;printf:;scanfd,n;getchar;break;
void addlistlianxirenhead
lianxirenp1,p2,h;
char name10;
printf0;
getsname;
ifstrcmpname,0!0
p1lianxirenmallocLEN;
strcpyp1name,name;
printf:;getsp1number;
printf:;getsp1job;
printfEmail:;getsp1email;
else return;
hp1;
while1
p2p1;
printf0;
getsname;
ifstrcmpname,00break;
else
p1lianxirenmallocLEN;
strcpyp1name,name;
printf:;getsp1number;
printf:;getsp1job;
printfEmail:;getsp1email;
p2nextp1;
p1headnext;
headnexth;
p2nextp1;
lianxirenxiugailistlianxirenhead
char a20;
printf:;
getsa;
ifheadNULL
printf;
return head;
lianxirenphead;
whilestrcmpa,pname!0strcmpa,pnumber!0
ppnext;
ifpNULLprintfn;
return head;
printf!;
printfn:;putspname;
printfn:;putspnumber;
printfn:;putspjob;
printfnEmail:;putspemail;
putcharn;
int n;
while1
printf1,2,3,4,Email 5,:;
scanfd,n;
getchar;
switchn
case 1:printf:;getspname;break;
case 2:printf:;getspnumber;break;
case 3:printf:;getspjob;break;
case 4:printfEmail:;getspemail;break;
case 5:return head;break;
default:printf!;break;
lianxirendeletelistlianxirenhead
char a20;
printf:;
getsa;
ifheadNULL
printf;
return head;
lianxirenphead,p1;
whilestrcmpa,pname!0strcmpa,pnumber!0
p1p;
ppnext;
ifpNULLprintfn;
return head;
printf!;
printfn:;putspname;
printfn:;putspnumber;
printfn:;putspjob;
printfnEmail:;putspemail;
putcharn;
char n;
printfYN;
ngetchar;
switchn
case y:
case Y:ifpheadheadpnext;freep;elsep1nextpnext;freep;printf!;break;
case N:
case n:printf!;break;
default:printf!;break;
return head;
void savelistlianxirenhead
FILE fp;
iffpfopendianhuabu.dat,wbNULL
printfFile cannot be openedn;
exit0;
ifheadNULL
printfn;
return;
lianxirenp1head;
whilep1!NULL
iffwritep1,LEN,1,fp!1
printfcannot open filen;
return;
p1p1next;
printf!n;
fclosefp;
lianxirenloadlistlianxirenhead
FILE fp;
iffpfopendianhuabu.dat,rbNULL
printfn;
exit0;
lianxirenp1,p2;
p1lianxirenmallocLEN;
iffreadp1,LEN,1,fp0
printf;
return head;
headp1;
p2p1;
p1lianxirenmallocLEN;
whilefreadp1,LEN,1,fp
p2nextp1;
p2p1;
p1lianxirenmallocLEN;
p2nextNULL;
freep1;
returnhead;
fclosefp;
int kouling
char s20;
printf:;
int n0;
whilen3
scanfs,s;
getchar;
ifstrcmps,201603905270
return 0;
elsen;
ifn3
printfn;
return 1;
printfn;
return 1;
20160390527
void caidan
printfn;
printfn;
printf 1n;
printf 2 n;
printf 3 n;
printf 4 n;
printf 5 n;
printf 6 n;
printf 7 n;
printfn;
void main
ifkouling return;
systemcls;
caidan;
printf :;
int n;scanfd,n;
getchar;
lianxirenhead;
while1
systemcls;
caidan;
switchn
case 1:
headcreatlist;
systemcls;
caidan;
printlisthead;
savelisthead;
shifanglisthead;
printfn;
printfn:;
scanfd,n;
getchar;break;,
case 2:
headloadlisthead;
chazhaohead;
shifanglisthead;
printfn;
printfn:;
scanfd,n;
getchar;break;
case 3:
headloadlisthead;
addlisthead;
systemcls;
caidan;
printlisthead;
savelisthead;
shifanglisthead;
printfn;
printfn:;
scanfd,n;
getchar;break;
case 4:
headloadlisthead;
headxiugailisthead;
savelisthead;
shifanglisthead;
printfn;
printfn:;
scanfd,n;
getchar;break;
case 5:
headloadlisthead;
headdeletelisthead;
savelisthead;
shifanglisthead;
printfn;
printfn:;
scanfd,n;
getchar;break;
case 6:
headloadlisthead;
paixulisthead;
shifanglisthead;
printfn;
printfn:;
scanfd,n;
getchar;break;
case 7:
systemcls;
return;break;
default:
printfn,:;
scanfd,n;
getchar;break;
Reviews
There are no reviews yet.