

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 <iostream.h> #include <conio.h> #include <stdio.h> #include <process.h> struct stu { int std_ID; char name[20]; float marks; struct stu *next; } first,last; void main() { clrscr(); int b; first=0; last=0; while (1) { cout << "To insert values into the Linked List press 1:"; cout<<"\nToview the Data stored in the Linked List press 2:"; cout<<"\nTo exit press 3:" ; cout<<"\n"; cin >> b; switch (b) { case 1: { struct stu *current; current = new stu; current -> next = 0; if ( first== 0 ) { first= current; last = current; } else { last -> next = current; last = current; } cout << "\nStudent ID: "; cin >> current -> std_ID; cout << "\nInput Name: "; gets ( current -> name ); cout << "\nInput Marks: "; cin >> current -> marks; break; } case 2: { struct stu *p;
p = first; while ( p != 0 ) { cout << "\nStudent's ID: " << p -> std_ID << "\nStudent's Name: "; puts ( p -> name ); cout << "Student's Marks: " << p -> marks; cout<<"\n"; p = p -> next; } break; } case 3: { exit(0); } } getch(); } }