Thursday, August 26, 2010

LinkLists in C++: Part 3

Third in the series of Link-List funtions.

/***************************************************/
#include< iostream.h >
#include< conio.h >
#include< stdlib.h >

struct node
{
int info;
node* next;
}*start, *end, *t;


void listnode()
{
t = start;
cout <<"\nTHE CONTENTS ARE\n";
while(t != NULL)
{
cout <info <
t = t->next;
}
}

void count()
{
t = start;
int ctr = 0;
while(t != NULL)
{
ctr++;
t = t->next;
}
cout <<"\nNUMBER OF NODES ARE" <
}

void search()
{
t = start;
int n, flag = 0;
cout <<"\nENTER INFO TO BE SEARCHED ::";
cin >>n;
while(t!= NULL)
{
if(t->info == n)
{
flag = 1;
break;
}
}
if(flag == 0)
cout <<"\nNOT FOUND";
else
cout <<"\nFOUND";
}

No comments:

Post a Comment