Home > Back-end >  Which eldest brother can put the following into the C language, C language I have ChongXie direct me
Which eldest brother can put the following into the C language, C language I have ChongXie direct me

Time:10-11

#include using namespace std; Typedef struct LNode {int data; LNode * next; } LNode * LinkList; Int CreateList (LinkList & amp; L, int n) {LNode * p, * r; int i; L=new LNode; L - & gt; Next=NULL; r=L; for(i=0; i P - & gt; data; P - & gt; Next=NULL; R - & gt; Next=p; R=p; } return 0; {} to void the display (LinkList L) LNode * p; P=L - & gt; Next; cout<& lt;" ("; While (p) {cout

=Max)) {pa=pa - & gt; Next; P=p - & gt; Next; } else {pa=pa - & gt; Next; P - & gt; Next=pa; }} return 0; } int main () {LinkList LA; int n; Int min; int max; cout<& lt;" Please input the length of the need to create a single table: "& lt; n; cout<& lt;" Please input in order to deposit data (tail interpolation & amp; & Increasing) : "& lt; & gt; Min. Cin> & gt; Max. ChooseList_L (LA, min, Max); cout<& lt;" Select delete after singly linked lists as follows: "; The display (LA); return 0; }

CodePudding user response:

Include with the stdio. H and stdlib. H

New LNode (LNode *) for malloc (sizeof (LNode));

Cin is changed to the scanf to cout such as printf not just finished

No c + + features

CodePudding user response:

This is the source of the building Lord
 # include & lt; iostream> 
using namespace std;

Typedef struct LNode
{
The int data;
LNode * next;
} LNode * LinkList;

Int CreateList (LinkList & amp; L, int n)
{
LNode * p, * r;
int i;
L=new LNode;
L - & gt; Next=NULL;
r=L;
for(i=0; i{
P=new LNode;
Cin> P - & gt; data;
P - & gt; Next=NULL;
R - & gt; Next=p;
R=p;
}
return 0;
}

Void the display (LinkList L)
{
LNode * p;
P=L - & gt; Next;
cout<& lt;" (";
While (p)
{
cout

P=p - & gt; Next;
}
cout<& lt;" ) "& lt; }

Int ChooseList_L (LinkList & amp; LA, int min, int Max)
{
LNode * pa;
LNode * p;
Pa=LA - & gt; Next;
P=LA;
While (pa)
{
If ((pa - & gt; Data<=min) | | (pa - & gt; Data>=Max))
{
Pa=pa - & gt; Next;
P=p - & gt; Next;
}
The else
{
Pa=pa - & gt; Next;
P - & gt; Next=pa;
}
}
return 0;
}

Int main ()
{
LinkList LA;
int n;
Int min;
int max;
cout<& lt;" Please input the length of the need to create a single table: "& lt; Cin> n;
cout<& lt;" Please input in order to deposit data (tail interpolation & amp; & Increasing) : "& lt; CreateList (LA, n);
cout<& lt;" Current singly linked lists A is: ";
The display (LA);
cout<& lt;" Delete list values greater than min and all the elements to be less than the Max, please input order min and Max: "& lt; Cin> Min.
Cin> Max.
ChooseList_L (LA, min, Max);
cout<& lt;" Select delete after singly linked lists as follows: ";
The display (LA);
return 0;
}

CodePudding user response:

refer to the second floor gz_qmc response:
this is the source of the building Lord
 # include & lt; iostream> 
using namespace std;

Typedef struct LNode
{
The int data;
LNode * next;
} LNode * LinkList;

Int CreateList (LinkList & amp; L, int n)
{
LNode * p, * r;
int i;
L=new LNode;
L - & gt; Next=NULL;
r=L;
for(i=0; i{
P=new LNode;
Cin> P - & gt; data;
P - & gt; Next=NULL;
R - & gt; Next=p;
R=p;
}
return 0;
}

Void the display (LinkList L)
{
LNode * p;
P=L - & gt; Next;
cout<& lt;" (";
While (p)
{
cout

P=p - & gt; Next;
}
cout<& lt;" ) "& lt; }

Int ChooseList_L (LinkList & amp; LA, int min, int Max)
{
LNode * pa;
LNode * p;
Pa=LA - & gt; Next;
P=LA;
While (pa)
{
If ((pa - & gt; Data<=min) | | (pa - & gt; Data>=Max))
{
Pa=pa - & gt; Next;
P=p - & gt; Next;
}
The else
{
Pa=pa - & gt; Next;
P - & gt; Next=pa;
}
}
return 0;
}

Int main ()
{
LinkList LA;
int n;
Int min;
int max;
cout<& lt;" Please input the length of the need to create a single table: "& lt; Cin> n;
cout<& lt;" Please input in order to deposit data (tail interpolation & amp; & Increasing) : "& lt; CreateList (LA, n);
cout<& lt;" Current singly linked lists A is: ";
The display (LA);
cout<& lt;" Delete list values greater than min and all the elements to be less than the Max, please input order min and Max: "& lt; Cin> Min.
Cin> Max.
ChooseList_L (LA, min, Max);
cout<& lt;" Select delete after singly linked lists as follows: ";
The display (LA);
return 0;
}


No, I will

CodePudding user response:

This is a C
This code porous
 # include & lt; iostream> 
using namespace std;

Typedef struct LNode
{
The int data;
LNode * next;
} LNode * LinkList;

Int CreateList (LinkList & amp; L, int n)
{
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related