Home > Back-end >  Do not understand, did anyone see how to change
Do not understand, did anyone see how to change

Time:10-26

CodePudding user response:

If you less a {

CodePudding user response:

Focuslight
reference 1 floor response:
you if a less {

# include "c1. H"
Typedef int ElemType;
# include "c2-2 h"
# include "bo2-2 h"

Void CreateList (LinkList & amp; L, int n)
{
Int I;
LinkList p;
L=(LinkList) malloc (sizeof (LNode));
L - & gt; Next=NULL;
Printf (" please enter data into % d \ n ", n);
for(i=n; I> 0; - I)
{
P=(LinkList) malloc (sizeof (LNode));
The scanf (" % d ", & amp; P - & gt; The data);
P - & gt; Next=L - & gt; next;
L - & gt; Next=p;
}
}

Void CreateList2 (LinkList & amp; L, int n)
{
Int I;
LinkList p,q;
L=(LinkList) malloc (sizeof (LNode));
L - & gt; Next=NULL;
Q=L;
Printf (" please enter data into % d \ n ", n);
for(i=1; i<=n; I++)
{
P=(LinkList) malloc (sizeof (LNode));
The scanf (" % d ", & amp; P - & gt; The data);
Q - & gt; Next=p;
Q=q - & gt; next;
}
P - & gt; Next=NULL;
}

Void MergeList (LinkList La, LinkList & amp; Lb, LinkList & amp; Lc)
{
LinkList pa=La - & gt; Next, pb=Lb - & gt; Next, the PC;
Lc=PC=La;
While (pa& & Pb)
If (pa - & gt; Data{
PC - & gt; Next=pa;
PC=PC - & gt; next;
Pa=pa - & gt; next;
}
The else
{
PC - & gt; Next=pb;
PC=PC - & gt; next;
Pb=pb - & gt; next;
}
If (pa) PC - & gt; Next=pa;
If (pb) PC - & gt; Next=pb;
Free (Lb);
}

Void visit ElemType (c)
{
Printf (" % d ", c);
}

Void main ()
{
int n=5;
LinkList La, Lb, Lc;
ElemType e;
Printf (" according to the decreasing order, ");
CreateList2 (La, n);
Printf (" La=");
ListTraverse (La, visit);
Printf (" in the increasing order, ");
CreateList (Lb, n);
Printf (" Lb=");
ListTraverse (Lb, visit);
ListDelete (La, 3, e);
Printf (" delete the third element in table La: ");
ListTraverse (La, visit);
MergeList (La and Lb, Lc);
Printf (" Lc=");
ListTraverse (Lc, visit);
}

CodePudding user response:

Focuslight
reference 1 floor response:
you if a less {

After I changed my, also is wrong, you should delete the third element, the deleted the second
  • Related