hi evey one my name is ahmmad and I,m learning c++ but there thing i don,t undarstan
so can you help me in this !???
I leaing the struc in c++ and list but whene i see a list example i have proplm
whene i use thr strut and lis in sem class I will show you the coode i hope you andstan me :S
ok....
#include<iostream.h>
#include<conio.h>
struct list{int d;list*next;}; // this is pointer next to the name of struct nexe ok...
void main(void);
list *head,*node,*tile,*k; //all this for lis... the tail use in the and of node and the head use beginning of the node ..
int i=0,x ;
node=new list;cin>>node->d;node->next=NULL; // this to do new lis and make the end of first list to be nothing >> NULL
tile=head=node; /// here why tail=head=node ?
while(i<3){
node=new list; //
cin>>node->d;
node->next=NULL;
tile->next=node;
tile=node;i++;
}
node=head;i=1;
while(node!=NULL){cout<<endl<<i<<" "<<node->d;i++;node=node->next;}
cout<<"\n ENTER VAL\n";cin>>x;
node=head;
while(node!=NULL)
{if(node->d==x){k=new list;cin>>k->d;k->next=node->next;node->next=k;break;}
node=node->next;}
node=head;i=1;
while(node!=NULL){cout<<endl<<i<<" "<<node->d;i++;node=node->next;}
getch();
return 0 ;
}
while(node!=NULL){cout<<endl<<i<<" "<<node->d;i++;node=node->next;} Please explain this node!=NULL){cout<<endl<<i<<" "<<node->d;i++;node=node->next;
cout<<"\n ENTER VAL\n";cin>>x;
node=head; why Please explain
while(node!=NULL)
{if(node->d==x){k=new list;cin>>k->d;k->next=node->next;node->next=k;break;} Please explain k=new list;cin>>k->d;k->next=node->next;node->next=k;brea
node=node->next;} Please explain node=node->next;} ????
node=head;i=1; and ??
while(node!=NULL){cout<<endl<<i<<" "<<node->d;i++;node=node->next;} Please explain
getch();
return 0 ;
}