Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SD
//Title of this code #include <iostream> using namespace std; struct nod { int info; nod *next; }; nod *v; nod v1; nod *v2=&v1; void aloc(nod *&v, int i) { while(v->next!=0)v=v->next; nod *c; c=new nod(); v->next=c; c->info=i; c->next=0; } void insertAfter(nod *&v, int i, int val) { while(v->info!=i)v=v->next; nod *c= new nod(); c->info=val; c->next=v->next; v->next=c; } void insertBefore(nod *&v, int i, int val) { while(v->next->info!=i)v=v->next; nod *c= new nod(); c->info=val; c->next=v->next; v->next=c; } int main() { (*v2).info=10; //cout<<(*v2).info; ///////////////////////////////// v=new nod(); //init v->info=0; v->next=0; nod *a=v; for(int i=1;i<=11;i++) aloc(v,i); v=a; insertAfter(v,5,2); v=a; insertBefore(v,9,2); for(int i=1;i<=14;i++){cout<<a->info;a=a->next;} }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Easy String Reverse Example
permutation of 1 to n
BubDoubArray
D. Traveling Graph
Default_Template
A • Potato Sacks
Web Browser History - SET
LIS
Rezolvare
template
Please log in to post a comment.