TOC o 11 h z t 2,2,3,3HYPERLINK l Toc28873150PAGEREF Toc28873150 h4
HYPERLINK l Toc28873151 1. PAGEREF Toc28873151 h4
HYPERLINK l Toc28873152 1 PAGEREF Toc28873152 h4
HYPERLINK l Toc28873153 2 PAGEREF Toc28873153 h4
HYPERLINK l Toc28873154 2. PAGEREF Toc28873154 h4
HYPERLINK l Toc28873155 1 PAGEREF Toc28873155 h4
HYPERLINK l Toc28873156 2 PAGEREF Toc28873156 h5
HYPERLINK l Toc28873157 3 PAGEREF Toc28873157 h5
HYPERLINK l Toc28873158 4 PAGEREF Toc28873158 h6
HYPERLINK l Toc28873159 5 PAGEREF Toc28873159 h17
HYPERLINK l Toc28873160 6 PAGEREF Toc28873160 h26
HYPERLINK l Toc28873161PAGEREF Toc28873161 h27
HYPERLINK l Toc28873162 1. PAGEREF Toc28873162 h27
HYPERLINK l Toc28873163 1 PAGEREF Toc28873163 h27
HYPERLINK l Toc28873164 2 PAGEREF Toc28873164 h27
HYPERLINK l Toc28873165 2. PAGEREF Toc28873165 h27
HYPERLINK l Toc28873166 1 PAGEREF Toc28873166 h27
HYPERLINK l Toc28873167 2 PAGEREF Toc28873167 h28
HYPERLINK l Toc28873168 3 PAGEREF Toc28873168 h28
HYPERLINK l Toc28873169 4 PAGEREF Toc28873169 h29
HYPERLINK l Toc28873170 5 PAGEREF Toc28873170 h30
HYPERLINK l Toc28873171 6 PAGEREF Toc28873171 h31
HYPERLINK l Toc28873172PAGEREF Toc28873172 h32
HYPERLINK l Toc28873173 1. PAGEREF Toc28873173 h32
HYPERLINK l Toc28873174 1 PAGEREF Toc28873174 h32
HYPERLINK l Toc28873175 2 PAGEREF Toc28873175 h32
HYPERLINK l Toc28873176 2. PAGEREF Toc28873176 h32
HYPERLINK l Toc28873177 1 PAGEREF Toc28873177 h32
HYPERLINK l Toc28873178 2 PAGEREF Toc28873178 h32
HYPERLINK l Toc28873179 3 PAGEREF Toc28873179 h34
HYPERLINK l Toc28873180 4 PAGEREF Toc28873180 h34
HYPERLINK l Toc28873181 5 PAGEREF Toc28873181 h38
HYPERLINK l Toc28873182 6 PAGEREF Toc28873182 h42
HYPERLINK l Toc28873183PAGEREF Toc28873183 h43
HYPERLINK l Toc28873184 1. PAGEREF Toc28873184 h43
HYPERLINK l Toc28873185 1 PAGEREF Toc28873185 h43
HYPERLINK l Toc28873186 2 PAGEREF Toc28873186 h43
HYPERLINK l Toc28873187 2. PAGEREF Toc28873187 h44
HYPERLINK l Toc28873188 1 PAGEREF Toc28873188 h44
HYPERLINK l Toc28873189 2 PAGEREF Toc28873189 h44
HYPERLINK l Toc28873190 3 PAGEREF Toc28873190 h44
HYPERLINK l Toc28873191 4 PAGEREF Toc28873191 h46
HYPERLINK l Toc28873192 5 PAGEREF Toc28873192 h46
HYPERLINK l Toc28873193 6 PAGEREF Toc28873193 h47
HYPERLINK l Toc28873194PAGEREF Toc28873194 h48
HYPERLINK l Toc28873195 1. PAGEREF Toc28873195 h48
HYPERLINK l Toc28873196 1 PAGEREF Toc28873196 h48
HYPERLINK l Toc28873197 2Prim PAGEREF Toc28873197 h48
HYPERLINK l Toc28873198 2. PAGEREF Toc28873198 h48
HYPERLINK l Toc28873199 1 PAGEREF Toc28873199 h48
HYPERLINK l Toc28873200 2 PAGEREF Toc28873200 h49
HYPERLINK l Toc28873201 3 PAGEREF Toc28873201 h49
HYPERLINK l Toc28873202 4 PAGEREF Toc28873202 h51
HYPERLINK l Toc28873203 5 PAGEREF Toc28873203 h54
HYPERLINK l Toc28873204 6 PAGEREF Toc28873204 h55
HYPERLINK l Toc28873205PAGEREF Toc28873205 h57
HYPERLINK l Toc28873206 1. PAGEREF Toc28873206 h57
HYPERLINK l Toc28873207 2. PAGEREF Toc28873207 h82
HYPERLINK l Toc28873208 3. PAGEREF Toc28873208 h88
HYPERLINK l Toc28873209 4. PAGEREF Toc28873209 h102
HYPERLINK l Toc28873210 5. PAGEREF Toc28873210 h106
linearlistn
O1
product
struct product
long num;
char name16;
char manurer32;
char date16;
long number;
double unitprice;
double totalprice;
struct product next;
;
struct product oneheadNULL;NULL
int n;
void menu;
void entvoid;
void broint;
void sor;
void que;
void del;
void add;
void savestruct product ;
struct product entry;
struct product recoverstruct product ,int;
void browsestruct product ;
struct product sortingstruct product ,int;
void query1char ,int;
void query2long ,long,int;
void query3char ,char ;
void query4double,double,int;
struct product deleter1struct product ,char ,int;
struct product deleter2struct product ,long,int;
struct product deleter3struct product ,double,int;
struct product addtostruct product,struct product ;
void menu
void ent
void broint
void sor
void que
void del
void add
struct product entry
struct product recoverstruct product ,int
void browsestruct product
struct product sortingstruct product ,int
void query1char ,int
void query2long,long,int
void query3char ,char
void query4double,double,int
struct product deleter1struct product ,char ,int
struct product deleter2struct product,long,int
struct productdeleter3struct product,double,int
struct productaddtostruct product,struct product
void savestruct product
,
PUSHPOPLIFO
nn
int main
int n;
int s;
struct stackstruct p;
printf: ;
scanfd, n;
stack1countstack2countqueuecount0;
while 1
printfn123n;
printf A,2,60;
pstruct stackstruct mallocsizeofstackstruct;
printfn;
scanfd,d,d, s, pid, ptime;
if s1break;
else
if s2
if stack1countn
push0, p;
printfdn, stackend1id;
printf: dn, stackend1time;
printf: dn, stack1count;
else
Enqueuep;
printfdn, pid;
printf: dn, ptime;
printf: dn, queuecount;
else
if s3
struct stackstruct temp;
while temppoppid, ptime ! NULL
push1, temp;
while stack2count ! 0
push0, pop1;
if queuecount ! 0
push0, Dequeueptime;
printfdn, stackend1id;
printf: dn, stackend1time;
printf: dn, stack1count;
return 0;
n22120223023403120100
123
poppush
lists
n
1112221,
112,
0
12
point
Glist creatGlistGlist Gl
Glist GreatGlistGlistGL,p,q,m,aGL,p,q,m,aNULLGLpqamq
str,m
len,f,f1,f2f,f1,f20lenff1,f2
GLp,qmf1f1f20
qf11f20qf11
af21
GL
Glist insertdateGlist GL
strteachername,graduatename
GlistStr,p,q,StrStrpq
GL
insertdateGlist GL
:
void delstudentGlist GLGlistStr,p,q,m,aGLpqamq
str,Str
f,ch
findstudentGlist GL
studentcountGlist GL
m,n
m
GlistprintGlist GL
0122022
modificationGlist GL
112211caojia2class2,12
;
NNHuffmanTree
huffmanhuffman
huffmanhuffamnhuffman
Select
huffman
uct HuNodeType
double weight;
HuNodeparent;
HuNode Lchild;
HuNodeRchild;
char value;
;
typedef struct HuCodeType HuCode;
struct HuCodeType
int bitsMAXBIT;
int start;
;
typedef struct HuffListHuList;
struct HuffList
HuNode Node;
HuList Next;
HuList Parent;
;
n2n1n1
nnTt1,t2,t3,t4tn;
01
58
X:X
.
nn11kruskalprim
GV,Eu,vuvwu,vTEwTTG
Prim
NV,ETEN
UuouoV,TE
uU,vVUu,vEEU0,voTE,VoU
UV
TEn1TV,TEN
G,n.U
typedef struct
char VM10;
int RMM;
int vexnum;
Graph;
typedef struct
int adjvex;
int lowcost;
closedgeMAX;
CreateCityGraph G:
LocateDistriGraph g,int u:
MinGraph g,closedge closedge:
PrimGraph G,G.distrinam1:
include stdio.h
include stdlib.h
include string.h
define INFINITY 10000
define M 20
typedef struct
char VM10;
int RMM;
int vexnum;
Graph;
struct tree
int weizhi;
int lowcost;
;
int creatgraphGraph g n
int i0,j,m,k,p;
char a10,b10;
printfttn;
printftn;
printft0n;
scanfs,gVi;
whilestrcmp0,gVi!0
i;
scanfs,gVi;
gvexnumi;
fori0;igvexnum;i
forj0;jgvexnum;j
gRijINFINITY;
printft0 0 0n;
scanfssd,a,b,m;
whilestrcmp0,a!0strcmp0,b!0m!0
klocatevexg,a;
plocatevexg,b; a,b
ifk1
printftsn,a;
return 0;
ifp1
printftsn,b;
return 0;
gRkpgRpkm; kppk
scanfssd,a,b,m;
return 1;
struct tree
int weizhi;
int lowcost;
;
int minimunstruct tree a,Graph g kik
int i,k,m0;
fori0;ig.vexnum;i
ifm0ai.lowcost!0
m1;
ki;
ifm1ai.lowcost!0
ifai.lowcostak.lowcost ki;
return k;
int locatevexGraph g,char a10 u
int i;
fori0;igvexnum;i uVi
ifstrcmpa,gVi0 return i;
ifigvexnum return 1;
int minimunstruct tree a,Graph g kik
int i,k,m0;
fori0;ig.vexnum;i
ifm0ai.lowcost!0
m1;
ki;
ifm1ai.lowcost!0
ifai.lowcostak.lowcost ki;
return k;
Prim
void MiniSpanTreePRIMGraph g,char a10
struct tree closedgeM;
int i,j,k,money0;
klocatevexg,a;
fori0;ig.vexnum;i
ifi!k
closedgei.lowcostg.Rki; k i
closedgei.weizhik;ik
closedgek.lowcost0; , Uu
printft : n;
fori0;ig.vexnum;i
forj0;jg.vexnum;j
printfd ,g.Rij;
printfnn;
printft : n;
fori1;ig.vexnum;i
kminimunclosedge,g; Tkmoneyclosedgek.lowcosto
moneyclosedgek.lowcost;
printfd:s s dn,i,g.Vclosedgek.weizhi,g.Vk,closedgek.lowcost;
closedgek.lowcost0;k U
forj0;jg.vexnum;j
ifg.Rkjclosedgej.lowcost
closedgej.weizhik;
closedgej.lowcostg.Rkj;
printft: d n,money;
int main
int i;
Graph g;
char a10;
icreatgraphg;
ifi
printfnta, : ;
scanfs,a;
MiniSpanTreePRIMg,a;
printfnthanks to use this programe!n;
return 0;
On3,02m
includestdio.h
includestdlib.h
includestring.h
includemalloc.h
define LEN sizeofstruct product
struct product
long num;
char name16;
char manurer32;
char date16;
long number;
double unitprice;
double totalprice;
struct product next;
;
struct product oneheadNULL;NULL
int n;
void menu;
void entvoid;
void broint;
void sor;
void que;
void del;
void add;
struct product entry;
struct product recoverstruct product ,int;
void browsestruct product ;
struct product sortingstruct product ,int;
void query1char ,int;
void query2long ,long,int;
void query3char ,char ;
void query4double,double,int;
struct product deleter1struct product ,char ,int;
struct product deleter2struct product ,long,int;
struct product deleter3struct product ,double,int;
struct product addtostruct product,struct product ;
void savestruct product ;
int main
menu;
return 0;
void menuvoid
int i,m0;
while1
printfttttn;
printfntn;
printfnt1tttt2n;
printfnt3tttt4n;
printfnt5tttt6n;
printfnt7n;
printfntn;
printfnt345n;
printfnt2n;
printfnt!n;
printfnt!n;
printfnt;
scanfd,i;
ifi7 break; i7
else
switchi
case 1:ent;m1;break;
case 2:brom;m1;break;
case 3:sor;break;
case 4:que;break;
case 5:del;break;
case 6:add;m1;break;
default :printfn!;
void entvoid
int i;
ifonehead!NULL
printfnn;
printfn? !n;
printfnt1t2n;
printf;
scanfd,i;
whilei!1i!2
printfn:;
scanfd,i;
ifi1oneheadNULL;n0;i00
else return ;
printfnn;
printf!n;
printfn;
printf..n;
printf11001 2018.11.10 10016.9n;
printf21002 2018.01.03912n;
printfn!n;
printfn;
printfn0!n;
oneheadentry;
saveonehead;
struct product entryvoid
struct product headNULL,p1,p2;head,p1,p2,head
int m0;0
p1p2struct product mallocLEN;p1,p2
printfnn;
printfn;
scanfld,p1num;
ifp1num0 return head;0
printfn;
scanfs,p1name;
printfn;
scanfs,p1manurer;
printfn;
scanfs,p1date;
printfn;
scanfld,p1number;
printfn;
scanflf,p1unitprice;
whilep1num!0
p1totalpricep1numberp1unitprice;
m;1
ifm1 headp1;1headp1
else p2nextp1;
p2p1;
p1struct product mallocLEN;
printfn0!n;
printfnn;
scanfld,p1num;
ifp1num0 break;0
printfn;
scanfs,p1name;
printfn;
scanfs,p1manurer;
printfn;
scanfs,p1date;
printfn;
scanfld,p1number;
printfn;
scanflf,p1unitprice;
nm;
p2nextNULL;p2
return head;
void broint m
int j;
printfnt1t2n;
printfn;
scanfd,j;
whilej!1j!2
printfn!;
scanfd,j;
ifj1oneheadrecoveronehead,m;j1
else browseonehead;
struct product recoverstruct product head,int m
ifmprintfnnn;return head;
FILE fp;
char s128;
int c0;
n0;0
struct product p1head,p2;
iffpfopenproduct information,rNULL
printfnn;
return head;
p1p2struct product mallocLEN;p1,p2
while!feoffpfp
ifc0fgetss,76,fp;c1;1
else
fscanffp,ldttsttsttsttldttlftlfn,p1num,p1name,p1manurer,p1date,p1number,p1unitprice,p1totalprice;
n;1
ifc!0n1headp1;01p1
else p2nextp1;p2p1
p2p1;p2p1
p1struct product mallocLEN;p1
p2nextNULL;p2
fclosefp;
printfnn;
return head;
void browsestruct product head
FILE fp;
char s128;
int c0;
struct product p1head;p1,p1
iffpfopenproduct information,rNULL
printfnn;
return ;
p1struct product mallocLEN;p1
printfnn;
printfnn;
while!feoffpfp
ifc0fgetss,76,fp;printftttttttn;c1;01
else
fscanffp,ldttsttsttsttldttlftlfn,p1num,p1name,p1manurer,p1date,p1number,p1unitprice,p1totalprice;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,p1num,p1name,p1manurer,p1date,p1number,p1unitprice,p1totalprice;
fclosefp;
void sorvoid
ifoneheadNULL
printfn!n;
return ;
int i;
printfnn;
printfnt1tttt2n;
printfnt3tttt4n;
printfnt5tttt6n;
printfnt;
scanfd,i;
ifi6 return;i6,
whilei!1i!2i!3i!4i!5
printfn:;
scanfd,i;
oneheadsortingonehead,i;
saveonehead;
struct product sortingstruct product head,int i
struct product first,tail,pm,m,p;firsttailpm,m,p;
int j;
printfnn;
printfnt1t2n;
printfnt;
scanfd,j;
whilej!1j!2
printfn:;
scanfd,j;
firstNULL;
ifheadnextNULL printfnn;return head;
ifj1
switchi
case 1:whilehead!NULL
forpmhead;pnext!NULL;ppnextp,mp
ifmnumpnextnummp
pmp;pmm
mpnext;m
iffirstNULL
firstm;m
tailm;tailm
else
tailnextm;tail
tailm;tailm
ifmheadheadheadnext;head,head
elsepmnextmnext;
iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 2:whilehead!NULL
forpmhead;pnext!NULL;ppnext
ifstrcmpmdate,pnextdate0
pmp;
mpnext;
iffirstNULL
firstm;
tailm;
else tailnextm;
tailm;
ifmheadheadheadnext;
elsepmnextmnext;
iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 3:whilehead!NULL
forpmhead;pnext!NULL;ppnext
ifmnumberpnextnumber
pmp;
mpnext;
iffirstNULL
firstm;
tailm;
else tailnextm;
tailm;
ifmheadheadheadnext;
elsepmnextmnext;
iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 4:whilehead!NULL
forpmhead;pnext!NULL;ppnext
ifmunitpricepnextunitprice
pmp;
mpnext;
iffirstNULL
firstm;
tailm;
else tailnextm;
tailm;
ifmheadheadheadnext;
elsepmnextmnext;
iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 5:whilehead!NULL
forpmhead;pnext!NULL;ppnext
ifmtotalpricepnexttotalprice
pmp;
mpnext;
iffirstNULL
firstm;
tailm;
else tailnextm;
tailm;
ifmheadheadheadnext;
elsepmnextmnext;
iffirst!NULL tailnextNULL;
headfirst;
printfnn;
else
switchi
case 1:whilehead!NULL
forpmhead;pnext!NULL;ppnext
ifmnumpnextnum
pmp;
mpnext;
iffirstNULL
firstm;
tailm;
else tailnextm;
tailm;
ifmheadheadheadnext;
elsepmnextmnext;
iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 2:whilehead!NULL
forpmhead;pnext!NULL;ppnext
ifstrcmpmdate,pnextdate0
pmp;
mpnext;
iffirstNULL
firstm;
tailm;
else tailnextm;
tailm;
ifmheadheadheadnext;
elsepmnextmnext;
iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 3:whilehead!NULL
forpmhead;pnext!NULL;ppnext
ifmnumberpnextnumber
pmp;
mpnext;
iffirstNULL
firstm;
tailm;
else tailnextm;
tailm;
ifmheadheadheadnext;
elsepmnextmnext;
iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 4:whilehead!NULL
forpmhead;pnext!NULL;ppnext
ifmunitpricepnextunitprice
pmp;
mpnext;
iffirstNULL
firstm;
tailm;
else tailnextm;
tailm;
ifmheadheadheadnext;
elsepmnextmnext;
iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 5:whilehead!NULL
forpmhead;pnext!NULL;ppnext
ifmtotalpricepnexttotalprice
pmp;
mpnext;
iffirstNULL
firstm;
tailm;
else tailnextm;
tailm;
ifmheadheadheadnext;
elsepmnextmnext;
iffirst!NULL tailnextNULL;
headfirst;
printfnn;
return head;
void quevoid
ifoneheadNULL
printfn!n;
return ;
int i;
long m,k;
double x,y;
char s132,s232;
while1
printfnn;
printfnt1tttt2n;
printfnt3tttt4n;
printfnt5tttt6n;
printfnt7tttt8n;
printfn;
printfnt;
scanfd,i;
printfn0!;
ifi8 break;i8
else
switchi
case 0:break;
case 1:printfnt;
scanfldld,m,k;
query2m,k,i;
break;
case 2:printfnt;
scanfs,s1;
query1s1,i;
break;
case 3:printfnt;
scanfs,s1;
query1s1,i;
break;
case 4:printfn12018.11.10n;
printfn22018.01.02n;
printfn!n;
printfnt;
scanfss,s1,s2;
query3s1,s2;
break;
case 5:printfnt;
scanfldld,m,k;
query2m,k,i;
break;
case 6:printfnt;
scanflflf,x,y;
query4x,y,i;
break;
case 7:printfnt;
scanflflf,x,y;
query4x,y,i;
break;
default :printfnt!;
void query1char s1,int i
struct product headonehead,p;head,p,headonehead
pstruct product mallocLEN;p
int c0,j0;
phead;phead
switchi
case 2:printfnn;
whilep!NULLp
ifstrcmps1,pname0p
if!jprintftttttttn;j1;j0j1
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;
ppnext;p
ifc0printfnn;0
break;
case 3:printfnn;
whilep!NULL
ifstrcmps1,pmanurer0
if!jprintftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;
ppnext;
ifc0printfnn;
void query2long m,long k,int i
struct product headonehead,p;
int c0,j0;
pstruct product mallocLEN;
phead;
switchi
case 1:printfnn;
whilep!NULL
ifpnummpnumk
if!jprintftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;
ppnext;
ifc0printfnn;
break;
case 5:printfnn;
whilep!NULL
ifpnumbermpnumberk
if!jprintftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;
ppnext;
ifc0printfnn;
void query3char s1,char s2
struct product headonehead,p;
int c0,j0;
pstruct product mallocLEN;
phead;
printfnn;
whilep!NULL
ifstrcmppdate,s10strcmppdate,s20
if!jprintftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;
ppnext;
ifc0printfnn;
void query4double x,double y,int i
struct product headonehead,p;
int c0,j0;
pstruct product mallocLEN;
phead;
switchi
case 6:printfnn;
whilep!NULL
ifpunitpricexpunitpricey
if!jprintftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;
ppnext;
ifc0printfnn;
break;
case 7:printfnn;
whilep!NULL
ifptotalpricexptotalpricey
if!jprintftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;
ppnext;
ifc0printfnn;
void delvoid
ifoneheadNULL
printfn!n;
return ;
int i;
long m;
double x;
char s32;
while1
printfnn;
printfnt1tttt2n;
printfnt3tttt4n;
printfnt5tttt6n;
printfnt7tttt8n;
printfn;
scanfd,i;
printfn!;
ifi8 break;i8
else
switchi
case 1:printfn;
scanfld,m;
oneheaddeleter2onehead,m,i;
break;
case 2:printfn;
scanfs,s;
oneheaddeleter1onehead,s,i;
break;
case 3:printfn;
scanfs,s;
oneheaddeleter1onehead,s,i;
break;
case 4:printfn12018.11.10n;
printfn22018.01.02n;
printfn!n;
printfn;
scanfs,s;
oneheaddeleter1onehead,s,i;
break;
case 5:printfn;
scanfld,m;
oneheaddeleter2onehead,m,i;
break;
case 6:printfn;
scanflf,x;
oneheaddeleter3onehead,x,i;
break;
case 7:printfn;
scanflf,x;
oneheaddeleter3onehead,x,i;
break;
default :printfn!;
saveonehead;
struct product deleter1struct product head,char s,int i
struct product p1head,p2;p1,p2p1
int c0;0
switchi
case 2:while1
whilestrcmps,p1name!0p1next!NULLp1p1
p2p1;p1p1next;p2p1p1
ifstrcmps,p1name0
ifp1headheadp1next;p1p1
elsep2nextp1next;p2p1
n;1
c1;c1
else break;
p1head;p1
ifc0 printfnn;
else printfn!;
break;
case 3:while1
whilestrcmps,p1manurer!0p1next!NULL
p2p1;p1p1next;
ifstrcmps,p1manurer0
ifp1headheadp1next;
elsep2nextp1next;
n;
c1;
else break;
p1head;
ifc0 printfnn;
else printfn!;
break;
case 4:while1
whilestrcmps,p1date!0p1next!NULL
p2p1;p1p1next;
ifstrcmps,p1date0
ifp1headheadp1next;
elsep2nextp1next;
n;
c1;
else break;
p1head;
ifc0 printfnn;
else printfn!;
return head;
struct product deleter2struct product head,long m,int i
struct product p1head,p2,p3head;
int c0;
switchi
case 1:while1
whilem!p1nump1next!NULL
p2p1;p1p1next;
ifmp1num
ifp1headheadp1next;
elsep2nextp1next;
n;
c1;
else break;
p1head;
ifc0 printfnn;
else printfn!;
break;
case 5:while1
whilem!p1numberp1next!NULL
p2p1;p1p1next;
ifmp1number
ifp1headheadp1next;
elsep2nextp1next;
n;
c1;
else break;
p1head;
ifc0 printfnn;
else printfn!;
return head;
struct product deleter3struct product head,double x,int i
struct product p1head,p2,p3head;
int c0;
switchi
case 6:while1
whilex!p1unitpricep1next!NULL
p2p1;p1p1next;
ifxp1totalprice
ifp1headheadp1next;
elsep2nextp1next;
n;
c1;
else break;
p1head;
ifc0 printfnn;
else printfn!;
break;
case 7:while1
whilex!p1totalpricep1next!NULL
p2p1;p1p1next;
ifxp1totalprice
ifp1headheadp1next;
elsep2nextp1next;
n;
c1;
else break;
p1head;
ifc0 printfnn;
else printfn!;
return head;
void addvoid
struct product pro;pro
prostruct product mallocLEN;pro
printfnn;
printfn!n;
printfnn;
printf..n;
printf11001 2018.11.10 10016.9n;
printf21002 2018.01.03912n;
printfn!n;
printfn0!n;
printfn;
printfn0!n;
printfnn;
scanfld,pronum;
ifpronum0 return ;0
printfn;
scanfs,proname;
printfn;
scanfs,promanurer;
printfn;
scanfs,prodate;
printfn;
scanfld,pronumber;
printfn;
scanflf,prounitprice;
whilepronum!00
n;1
prototalpricepronumberprounitprice;
oneheadaddtoonehead,pro;
prostruct product mallocLEN;
printfn0!n;
printfnn;
scanfld,pronum;
ifpronum0 break;
printfn;
scanfs,proname;
printfn;
scanfs,promanurer;
printfn;
scanfs,prodate;
printfn;
scanfld,pronumber;
printfn;
scanflf,prounitprice;
saveonehead;
struct product addtostruct product head,struct product pro
struct product p;P
phead;P
ifheadNULL
headpro;pronextNULL;pro
else
whilepnext!NULLP
ppnext;P
pnextpro;Ppro
pronextNULL;pro
return head;
void savestruct product head
ifheadNULL
printfn!!n;
return ;
FILE fp;
struct product phead;
iffpfopenproduct information,wNULL
printf!;
return ;
fprintffp,ttt..tttn;
whilep!NULL
fprintffp,4ldttsttsttstt4ldtt8lft8lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
ppnext;
fclosefp;
includestdio.h
includestdlib.h
includestring.h
includemath.h
define P 2
struct stackstruct stackhead1, stackend1;
struct stackstruct stackhead2, stackend2;
struct queuestruct queuehead, queueend;
int stack1count, stack2count;
int queuecount;
struct stackstruct
int id;
int time;
struct stackstruct pre;
struct stackstruct next;
;
struct queuestruct
int id;
struct queuestruct next;
;
void pushint flag, struct stackstruct p
struct stackstruct stack;
if flag0 1
if stack1count0
stackhead1struct stackstruct mallocsizeofstruct stackstruct;
stackhead1idpid;
stackhead1timeptime;
stackhead1nextNULL;
stackhead1preNULL;
stackend1stackhead1;
else
stackstruct stackstruct mallocsizeofstruct stackstruct;
stackidpid;
stacktimeptime;
stackend1nextstack;
stackprestackend1;
stacknextNULL;
stackend1stack;
stack1count;
else
if flag1 2
if stack2count0
stackhead2struct stackstruct mallocsizeofstruct stackstruct;
stackhead2idpid;
stackhead2timeptime;
stackhead2nextNULL;
stackhead2preNULL;
stackend2stackhead2;
else
stackstruct stackstruct mallocsizeofstruct stackstruct;
stackidpid;
stacktimeptime;
stackend2nextstack;
stackprestackend2;
stacknextNULL;
stackend2stack;
stack2count;
struct stackstruct popint id, int time
struct stackstruct stack;
stackstruct stackstruct mallocsizeofstruct stackstruct;
if stackend1id ! id
stackidstackend1id;
stacktimestackend1time;
stackprestackend1pre;
freestackend1;
stackend1stackpre;
stackend1nextNULL;
stack1count;
else
stackidstackend1id;
stacktimestackend1time;
stackprestackend1pre;
printfdn, id;
printf: dn, timestacktime;
printf: d: dn,P, Ptimestacktime;
freestackend1;
if stack1count0
stackend1stackhead1NULL;
else
stackend1stackpre;
stackend1nextNULL;
stackNULL;
return stack;
struct stackstruct pop1
struct stackstruct stack;
stackstruct stackstruct mallocsizeofstruct stackstruct;
stackidstackend2id;
stacktimestackend2time;
stackprestackend2pre;
freestackend2;
stackend2stackpre;
stack2count;
return stack;
void Enqueuestruct stackstruct p
struct queuestruct queue;
if queuecount0
queueheadstruct queuestruct mallocsizeofstruct queuestruct;
queueheadidpid;
queueheadnextNULL;
queueendqueuehead;
else
queuestruct queuestruct mallocsizeofstruct queuestruct;
queueidpid;
queuenextNULL;
queueendnextqueue;
queueendqueue;
queuecount;
struct stackstruct Dequeueint time
struct stackstruct stack;
stackstruct stackstruct mallocsizeofstruct stackstruct;
stackidqueueheadid;
stacktimetime;
if queuecount0
queueheadNULL;
queueendNULL;
else
queueheadqueueheadnext;
return stack;
int main
int n;
int s;
struct stackstruct p;
printf: ;
scanfd, n;
stack1countstack2countqueuecount0;
while 1
printfn123n;
printf A,2,60;
pstruct stackstruct mallocsizeofstackstruct;
printfn;
scanfd,d,d, s, pid, ptime;
if s1break;
else
if s2
if stack1countn
push0, p;
printfdn, stackend1id;
printf: dn, stackend1time;
printf: dn, stack1count;
else
Enqueuep;
printfdn, pid;
printf: dn, ptime;
printf: dn, queuecount;
else
if s3
struct stackstruct temp;
while temppoppid, ptime ! NULL
push1, temp;
while stack2count ! 0
push0, pop1;
if queuecount ! 0
push0, Dequeueptime;
printfdn, stackend1id;
printf: dn, stackend1time;
printf: dn, stack1count;
return 0;
includestdio.h
includestdlib.h
includestring.h
typedef struct GLnode
char name20;
char position20;
int level;
struct
GLnode peer;
GLnode next;
point;
Glist;
Glist creatGlist
Glist GL,p,q,m,a;p,q,am
char str200;
int len,f,f1,f2,i,j;lenff1,f2
iff1f20;
GLpqmaNULL;
printfplease input str such as xiaomingteacher0orxiaoming1class1 : n;
scanfs,str;
lenstrlenstr;str
whileilen
ifstri
i;
continue;
else
mGlist mallocsizeofGlist;
forj0;stri!;i
mnamejstri;
mnamej0;
fori,j0;stri!;i
mpositionjstri;
mpositionj0;
mlevelstri48;
mpoint.peermpoint.nextNULL;
i;
ifmlevel0
iff
ppoint.peerm;
pm;
else
GLpm;
f1;
f1f20;f0,
aqm; aq
else
ifmlevel1
iff1
qpoint.peerm;
else
qpoint.nextm;
f11;
f20;
aqm;
else
iff2
apoint.peerm;
else
apoint.nextm;
f21;
am;
return GL;
void GlistprintGlist GL
Glist p,q,a;
int f,f1,f2;
pGL;
ff1f20;
printf;
while1
ifpNULL break;
iff
printf,ssd,pname,pposition,plevel;
else
printfssd,pname,pposition,plevel;
f1;
qppoint.next;
f1f20;
while1
ifqNULL break;
iff1
ifqlevel1
printf,ssd,qname,qposition,qlevel;
else
printf,ssd,qname,qposition,qlevel;
else
printf,ssd,qname,qposition,qlevel;
f11;
aqpoint.next;
f20;
while1
ifaNULL break;
iff2
printf,ssd,aname,aposition,alevel;
else
printf,ssd,aname,aposition,alevel;
f21;
aapoint.peer;
iff2 printf;
ifqlevel1qpoint.peerNULL printf;
qqpoint.peer;
printf;
pppoint.peer;
printfn;
void inStrGlist StrStr
char str100;
int i,j;
printfplease input student information such as xiaohong1class1 : ;
scanfs,str;
forij0;stri!;i
Strnamejstri;
Strnamej0;
forj0,i;stri!;i
Strpositionjstri;
Strpositionj0;
Strlevelstri48;
Strpoint.peerStrpoint.nextNULL;
Glist insertdateGlist GL
char str100,teachername30,graduatename30;
Glist Str,p,q;
int i,j;
pGL;
StrGlist mallocsizeofGlist;
inStrStr;
ifStrlevel2
printfplease input the s teachername : ,Strname;
scanfs,teachername;
printfn;
whilestrcmppname,teachername
pppoint.peer;
ifpNULL break;
ifpNULL printfthe s teacher no foundn,teachername;
else
ifppoint.nextNULLppoint.nextlevel2
Strpoint.peerppoint.next;
ppoint.nextStr;
printfinsert success!n;
else
printfplease input beyond graduatename : ;
scanfs,graduatename;
printfn;
qppoint.next;
whilestrcmpqname,graduatename
qqpoint.peer;
ifqNULL break;
ifqNULL printfthe s is no found!n,graduatename;
else
Strpoint.peerqpoint.next;
qpoint.nextStr;
printfinsert success!n;
else
printfplease input the s teachername : ,Strname;
scanfs,teachername;
printfn;
whilestrcmppname,teachername
pppoint.peer;
ifpNULL break;
ifpNULL printfthe s teacher no foundn,teachername;
else
ifppoint.nextNULLppoint.nextlevel1
Strpoint.peerppoint.next;
ppoint.nextStr;
printfinsert success!n;
else
Strpoint.nextppoint.next;
ppoint.nextStr;
printfinsert success!n;
return GL;
void delstudentGlist GL
char str100;
Glist Str,p,q,a,m;
int i,j,f,c;
pGL;
f0;
StrGlist mallocsizeofGlist;
inStrStr;
ifStrlevel2
whilep!NULL!f
qppoint.next;
ifqlevel2
mq;
whileq!NULL!f
if!strcmpqname,Strname!strcmpqposition,Strposition
printfdelete this student ssd ?n,Strname,Strposition,Strlevel;
printfplease input 1yes or 0no : ;
scanfd,c;
ifc1
ifppoint.nextq
ppoint.nextqpoint.peer;
else
mpoint.peerqpoint.peer;
freeq;
printfdelete successn;
f1;
else
mq;
qqpoint.peer;
else
ifqlevel1
whileq!NULL!f
aqpoint.next;
ma;
whilea!NULL!f
if!strcmpaname,Strname!strcmpaposition,Strposition
printfdelete this student ssd ?n,Strname,Strposition,Strlevel;
printfplease input 1yes or 0no : ;
scanfd,c;
ifc1
ifqpoint.nexta
qpoint.nextapoint.peer;
else
mpoint.peerapoint.peer;
freea;
printfdelete success !;
f1;
else
ma;
aapoint.peer;
qqpoint.peer;
pppoint.peer;
else
whilep!NULL!f
qppoint.next;
mq;
whileq!NULL!f
if!strcmpqname,Strname!strcmpqposition,Strposition
ifqpoint.next!NULL
printfthe graduate have student,cant delete!n;
f1;
else
printfdelete this graduate ssd ?n,Strname,Strposition,Strlevel;
printfplease input 1yes or 0no : ;
scanfd,c;
ifc1
ifppoint.nextq
ppoint.nextqpoint.peer;
else
mpoint.peerqpoint.peer;
freeq;
printfdedete success!;
f1;
else
mq;
qqpoint.peer;
pppoint.peer;
if!f
printfyou delete person maybe is teacher,the teacher cant delete ! or the person no found!!!n;
printfn;
void findstudentGlist GL
char str30;
Glist p,q,a;
int f0; 0
pGL;
printfplease input check name,such as xiaoming :;
scanfs,str;
printfn;
whilep
qppoint.next;
if!strcmppname,str
printfpersonal information namepositionlevel :n;
printfssdn,pname,pposition,plevel;
f1;
else ifqlevel2
aq;
whilea
if!strcmpaname,str
printfpersonal information namepositionlevel :n;
printfssdn,aname,aposition,alevel;
printfthe students teachers personal information namepositionlevel :n;
printfssdn,pname,pposition,plevel;
f1;
aapoint.peer;
else
whileq
aqpoint.next;
if!strcmpqname,str
printfpersonal information namepositionlevel :n;
printfssdn,qname,qposition,qlevel;
printfthe graduates teachers personal information namepositionlevel :n;
printfssdn,pname,pposition,plevel;
f1;
else whilea
if!strcmpaname,str
printfpersonal information namepositionlevel :n;
printfssdn,aname,aposition,alevel;
printfthe graduate personal information namepositionlevel :n;
printfssdn,qname,qposition,qlevel;
printfthe students teachers personal information namepositionlevel :n;
printfssdn,pname,pposition,plevel;
f1;
aapoint.peer;
qqpoint.peer;
pppoint.peer;
if!f printfno found!!!n;
printfn;
void studentcountGlist GL
char teachername30;
Glist p,q,a;
int m0,n0;graugra
pGL;
printfplease input teachers name :;
scanfs,teachername;
printfn;
whilestrcmppname,teachername
pppoint.peer;
ifpNULL break;
if!p printfno found teacher!n;
else
qppoint.next;
whileq
m;
aqpoint.next;
whilea
n;
aapoint.peer;
qqpoint.peer;
ifppoint.nextlevel1
printfgraduate numbers :dn,m;
printfstudent numbers :dn,n;
else
printfstudent numbers:dn,m;gra
printfn;
void modificationGlist GL
Glist p,q,a,Str;
char personname30;
int f0;
pGL;
StrGlist mallocsizeofGlist;
printf :n;
inStrStr;
GlistprintGL;
printf;
scanfs,personname;
whilep
qppoint.next;
if!strcmppname,personname!f
ifplevelStrlevel
strcpypname,Strname;
strcpypposition,Strposition;
f1;
else
whileq
aqpoint.next;
if!strcmpqname,personname!f
ifqlevelStrlevel
strcpyqname,Strname;
strcpyqposition,Strposition;
f1;
else
whilea
if!strcmpaname,personname!f
ifalevelStrlevel
strcpyaname,Strname;
strcpyaposition,Strposition;
f1;
aapoint.peer;
qqpoint.peer;
pppoint.peer;
if!f printfn;
else printfn;
void menu
printfttn;
printft 1. tt 2.n;
printft 3. tt 4.n;
printft 5. tt 6.n;
printft 7. tt 8.n;
printfn;
void functionselectionGlist GL
int x;
while1
menu;
printfnplease enter the function to be implemented18,8 is exit system :;
scanfd,x;
switchx
case 1:GLcreatGlist;break;
case 2:GLinsertdateGL;break;
case 3:delstudentGL;break;
case 4:findstudentGL;break;
case 5:studentcountGL;break;
case 6:GlistprintGL;break;
case 7:modificationGL;break;
case 8:break;
default:printfplease reenter!!;
ifx8 break;
int main
Glist GL;
functionselectionGL;
return 0;
include iostream
includestdlib.h
using namespace std;
define MAXBIT 30
typedef structHuNodeTypeHuNode;
struct HuNodeType
double weight;
HuNodeparent;
HuNode Lchild;
HuNodeRchild;
char value;
;
typedef struct HuCodeType HuCode;
struct HuCodeType
int bitsMAXBIT;
int start;
;
typedef struct HuffListHuList;
struct HuffList
HuNode Node;
HuList Next;
HuList Parent;
;
HuNode HuffmanTreeint n
HuList HuffListHuListmallocsizeofstruct HuffList;
HuffListNextNULL;
HuffListNodeNULL;
HuList N,PHuffList;
HuNode tmp;
for int i0; in; i
tmpHuNodemallocsizeofstruct HuNodeType;
NHuListmallocsizeofstruct HuffList;
tmpLchildNULL;
tmpRchildNULL;
tmpparentNULL;
cout2 5 :endl;
cintmpvaluetmpweight;
NNodetmp;
NNextNULL;
PNextN;
NParentP;
PN;
HuList X1, X2;
while HuffListNextNext ! NULL
PHuListmallocsizeofstruct HuffList;
tmpHuNodemallocsizeofstruct HuNodeType;
NHuffListNext;
tmpweight10000;
PNodetmp;
X1P;
X2P;
for N; N ! NULL; NNNext
if NNodeweightX1Nodeweight
X2X1;
X1N;
else if NNodeweightX2Nodeweight
X2N;
tmpweightX1NodeweightX2Nodeweight;
tmpLchildX1Node;
tmpRchildX2Node;
X1Nodeparenttmp;
X2Nodeparenttmp;
PNodetmp;
coutX1Nodevalue :X1Nodeweight
X2Nodevalue: X2Nodeweightendl;
PParentHuffList;
PNextHuffListNext;
HuffListNextParentP;
HuffListNextP;
X1X2;
if X1NextX2
X1ParentNextX2Next;
ifX2Next ! NULL
X2NextParentX1Parent;
else
X1ParentNextX1Next;
ifX1Next ! NULL
X1NextParentX1Parent;
if X2NextX1
X2ParentNextX1Next;
if X1Next ! NULL
X1NextParentX2Parent;
else
X2ParentNextX2Next;
ifX2Next ! NULL
X2NextParentX2Parent;
HuffListNextNodeparentNULL;
return HuffListNextNode;
void HuffmanCodeHuNode RootTree
if RootTree
if RootTreeLchildNULLRootTreeRchildNULL
printfc: , RootTreevalue;;
HuNode RRootTree;
int BitMAXBIT;
int S0;
while Rparent ! NULL
if RparentLchildR
BitS0;
else
BitS1;
S;
RRparent;
S;
for S; S0; S
coutBitS;
coutendl;
HuffmanCodeRootTreeLchild;
HuffmanCodeRootTreeRchild;
int main
int n;
coutendl;
cinn;
HuNode RootTreeHuffmanTreen;
HuffmanCodeRootTree;
return 0;
include stdio.h
include stdlib.h
include string.h
define INFINITY 10000
define M 20
typedef struct
char VM10;
int RMM;
int vexnum;
Graph;
int locatevexGraph g,char a10 u
int i;
fori0;igvexnum;i uVi
ifstrcmpa,gVi0 return i;
ifigvexnum return 1;
int creatgraphGraph g n
int i0,j,m,k,p;
char a10,b10;
printfttn;
printf : a,0;
scanfs,gVi;
whilestrcmp0,gVi!0
i;
scanfs,gVi;
gvexnumi;
fori0;igvexnum;i
forj0;jgvexnum;j
gRijINFINITY;
printfa b 5,ab,5ab,0 0 0n;
scanfssd,a,b,m;
whilestrcmp0,a!0strcmp0,b!0m!0
klocatevexg,a;
plocatevexg,b; a,b
ifk1
printfsn,a;
return 0;
ifp1
printfsn,b;
return 0;
gRkpgRpkm; kppk
scanfssd,a,b,m;
return 1;
struct tree
int weizhi;
int lowcost;
;
int minimunstruct tree a,Graph g kik
int i,k,m0;
fori0;ig.vexnum;i
ifm0ai.lowcost!0
m1;
ki;
ifm1ai.lowcost!0
ifai.lowcostak.lowcost ki;
return k;
void MiniSpanTreePRIMGraph g,char a10
struct tree closedgeM;
int i,j,k,money0;
klocatevexg,a;
fori0;ig.vexnum;i
ifi!k
closedgei.lowcostg.Rki; k i
closedgei.weizhik;ik
closedgek.lowcost0; , Uu
printfn : n;
fori0;ig.vexnum;i
forj0;jg.vexnum;j
printfdt,g.Rij;
printfnn;
printf : n;
fori1;ig.vexnum;i
kminimunclosedge,g; Tkmoneyclosedgek.lowcosto
moneyclosedgek.lowcost;
printfd:s s dn,i,g.Vclosedgek.weizhi,g.Vk,closedgek.lowcost;
closedgek.lowcost0;k U
forj0;jg.vexnum;j
ifg.Rkjclosedgej.lowcost
closedgej.weizhik;
closedgej.lowcostg.Rkj;
printft: d n,money;
int main
int i;
Graph g;
char a10;
icreatgraphg;
ifi
printfnta, : ;
scanfs,a;
MiniSpanTreePRIMg,a;
printfnthanks to use this programe!n;
return 0;
PAGEMERGEFORMAT 49
i7
i
i
Y
N
N
Y
Y
N
N
Y
N
Y
N
Y
Y
N
N
Y
N
Y
Reviews
There are no reviews yet.