Sunday, November 16, 2008

Node.h (data structures)

#include "Node.h"

int main()
{
Node n;
int choice=0;
int val=0;

while(choice!=5)
{
cout<<"\n1.Enter new item";
cout<<"\n2.Remove item";
cout<<"\n3.Dislplay list";
cout<<"\n4.Get item count";
cout<<"\n5.Exit";
cout<<"\nChoice:";
cin>>choice;

switch(choice)
{
case 1:
cout<<"\nEnter Value of new item:";
cin>>val;
n.setData(val);
n.displayItems();
break;

case 2:
cout<<"\nEnter value of item:";
cin>>val;
n.removeNode(val);
n.displayItems();
break;

case 3:
n.displayItems();
break;

case 4:
cout<<"\nNode count:"< break;

case 5:
return 0;
default:
cout<<"\nWrong choice:";
}
}
return 0;
}


No comments: