Professional Documents
Culture Documents
Project 1
Project 1
Project 1
//#include <bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<string>
// Node Class
class Node {
public:
int roll;
string Name;
string Dept;
int Marks;
Node* next;
};
bool check(int x)
// Base Case
if (head == NULL)
return false;
t = head;
while (t != NULL) {
if (t->roll == x)
return true;
t = t->next;
return false;
if (check(roll)) {
return;
t->roll = roll;
t->Name = Name;
t->Dept = Dept;
t->Marks = Marks;
t->next = NULL;
// Insert at Begin
t->next = head;
head = t;
}
else {
Node* c = head;
c = c->next;
t->next = c->next;
c->next = t;
<< "Successfully\n";
// if head is NULL
if (!head) {
<< "Available\n";
return;
// Otherwise
else {
Node* p = head;
while (p) {
if (p->roll == roll) {
return;
p = p->next;
if (p == NULL)
<< "Available\n";
// if it exist
Node* t = head;
Node* p = NULL;
// Deletion at Begin
if (t != NULL
head = t->next;
delete t;
cout << "Record Deleted "
<< "Successfully\n";
return 0;
p = t;
t = t->next;
if (t == NULL) {
return -1;
p->next = t->next;
delete t;
<< "Successfully\n";
return 0;
// Record
void Show_Record()
Node* p = head;
if (p == NULL) {
else {
<< "\tMarks\n";
while (p != NULL) {
p = p->next;
// Driver code
int main()
head = NULL;
// Menu-driven program
while (true) {
int Choice;
// Enter Choice
if (Choice == 1) {
else if (Choice == 2) {
"record is to be deleted\n";
Delete_Record(Roll);
else if (Choice == 3) {
Search_Record(Roll);
else if (Choice == 4) {
Show_Record();
}
else if (Choice == 5) {
exit(0);
else {
return 0;