/*
welcome to tzt code
*/
#include<iostream>
#include<conio.h>
using namespace std;
class node
{
public:
int info;
node *next;
node()
{
info=0;
next=0;
}
};
void main()
{
cout<<"wellcome to TZT code"<<endl;
/*creating first node of linked list*/
node *list=new node;
list->info=5;
list->next=0;
/*creating second node and puting it after 1st node*/
node *neww=new node;
neww->info=8;
neww->next=0;
/*creating third node and puting it between first and second node*/
node *x=new node;
x->info=7;
x->next=neww;
list->next=x;
/*Now searchine all nodes showing data part of it*/
node *p;
int i=0;
p=list;
while(p!=0)
{
i++;
cout<<"data of node no "<<i<<" is "<<p->info<<endl;
p=p->next;
}
cout<<"Total nodes are:" <<i<<endl;
_getch();
}
welcome to tzt code
*/
#include<iostream>
#include<conio.h>
using namespace std;
class node
{
public:
int info;
node *next;
node()
{
info=0;
next=0;
}
};
void main()
{
cout<<"wellcome to TZT code"<<endl;
/*creating first node of linked list*/
node *list=new node;
list->info=5;
list->next=0;
/*creating second node and puting it after 1st node*/
node *neww=new node;
neww->info=8;
neww->next=0;
/*creating third node and puting it between first and second node*/
node *x=new node;
x->info=7;
x->next=neww;
list->next=x;
/*Now searchine all nodes showing data part of it*/
node *p;
int i=0;
p=list;
while(p!=0)
{
i++;
cout<<"data of node no "<<i<<" is "<<p->info<<endl;
p=p->next;
}
cout<<"Total nodes are:" <<i<<endl;
_getch();
}