|
|
|
@ -1,16 +1,16 @@
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
|
|
|
|
|
|
|
|
|
|
typedef struct node
|
|
|
|
|
{
|
|
|
|
|
int data;
|
|
|
|
|
struct node *next;
|
|
|
|
|
}node,*link;
|
|
|
|
|
}link;
|
|
|
|
|
|
|
|
|
|
link* a(){
|
|
|
|
|
link *p=(link*)malloc(sizeof(link));
|
|
|
|
|
p->netx=NULL;
|
|
|
|
|
link* p=(link*)malloc(sizeof(link));
|
|
|
|
|
p->next=NULL;
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -19,11 +19,13 @@ link* b(link* p){
|
|
|
|
|
link *c=a();
|
|
|
|
|
while(temp->next){
|
|
|
|
|
link *temp = p;
|
|
|
|
|
while(temp)){
|
|
|
|
|
while(temp){
|
|
|
|
|
temp=temp->next;
|
|
|
|
|
}
|
|
|
|
|
initlink(c,temp->data);
|
|
|
|
|
int m = temp->data;
|
|
|
|
|
initlink(c,m);
|
|
|
|
|
}
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void initlink(link* p,int n){
|
|
|
|
|