Professional Documents
Culture Documents
CAP-282
12113647
Kiran Pilania
#include <iostream>
#include <stdlib.h>
#include <malloc.h>
using namespace std;
void push(int);
void pop();
void display();
void search(int);
struct node
{
int data;
struct node *next;
} *head = NULL;
int main()
{
int choice, num, search_num;
while (true)
{
cout << ".....MENU....." << endl;
cout << "1. Push" << endl;
cout << "2. Pop" << endl;
cout << "3. Display" << endl;
cout << "4. Search" << endl;
void display()
{
struct node *r;
r = head;
if (r == NULL)
{
cout << "Stack is empty" << endl;
return;
}
else
{
while (r != NULL)
{
cout << r->data << " ";
r = r->next;
}
}
cout << "\n\n";
};