


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



#include<stdio.h> #include<conio.h> #include<iostream.h> #include<string.h> struct data { int num1; struct data1 *next1; };
struct data { int num2; struct data2 *next2; };
struct data { int num3; struct data3 *next3; };
void input1 (void); void insert1 (void); void insert2 (void); void insert3 (void); void display1 (void); void display2 (void); void display3 (void);
struct data1 current1,p1,first1,last1;struct data current2,p2,first2,last2; struct data3 current3,p3,first3,last3; void main () { int choice=0; first1=NULL; last1=NULL; first2=NULL; last2=NULL; first3=NULL; last3=NULL; while (choice!=5) { clrscr(); cout<<"\n\t\t\t\n\nEnter one of the following options:\n\n\t\t- To Insert Data press:\t\t\t\t1\n\t\t- To display the whole data press:\t\t2\n\t\t-
if (current1->num>=0) { insert2(); } else { insert3(); } break;
case 2: display1(); break;
case 3: display2(); break;
case 4: display3(); break;
case 5: break;
default: cout<<"\nYou Entered the wrong choice. Enter again\n"; getch();
void input1 (void) { /For New Data/ current1=new data1; current1->next1=NULL; cout<<"\n\n\nEnter data:\t"; cin>>current1->num1;
}
void insert1 (void) {
if(first1==NULL) { first1=last1=current1; } else
void display2 (void) { p2=first2;srn=1;
if(p2==NULL) { cout<<"\nThere is no DATA in the list\n"; } else { while (p2!=NULL) { cout<<"\n\n Sr #: "<<srn; cout<<"\n\tData:\t"<<p2->num2<<"\n"; p2=p2->next2;srn++; } }
void display3 (void) { p3=first3;srn=1;
if(p3==NULL) { cout<<"\nThere is no DATA in the list\n"; } else { while (p3!=NULL) { cout<<"\n\n Sr #: "<<srn; cout<<"\n\tData:\t"<<p3->num3<<"\n"; p3=p3->next3;srn++; } }