Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Data Display and Comparison-Data Structures and Representation-Assigment, Exercises of Data Structures and Algorithms

This task was assigned by Prof. Chandrashekar Baag at Amrita Vishwa Vidyapeetham. This assignment is related to Data Structures and Representation course. It includes: Data, Input, Display, Current, Choice, Options, Press, Case, Switch

Typology: Exercises

2011/2012

Uploaded on 07/30/2012

dhanvantari
dhanvantari 🇮🇳

2

(2)

48 documents

1 / 4

Toggle sidebar

Related documents


Partial preview of the text

Download Data Display and Comparison-Data Structures and Representation-Assigment and more Exercises Data Structures and Algorithms in PDF only on Docsity! #include<stdio.h> #include<conio.h> #include<iostream.h> #include<string.h> struct data1 { int num1; struct data1 *next1; }; struct data2 { int num2; struct data2 *next2; }; struct data3 { 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 data2 *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- - To display the positive data press:\t\t3\n\t\t- To display the negative data press:\t\t4\n\t\t- To exit press:\t\t\t\t\t5\n\nEnter Choice:\t"; cin>>choice; switch (choice) { case 1: input1(); insert1(); docsity.com 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 docsity.com
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved