Mini Project
Mini Project
Class : S.e
Section: b
Code:
#include<iostream>
#include<windows.h>
void enqueue(int);
void dequeue();s
int isempty();
int isfull();
void array_call();
void show();
int marks[total];
int counter = 0;
struct list
int data;
list * next;
};
int linklist_counter = 0;
void linklist_insert();
void linklist_call();
void linklist_dequeu();
void linklist_show();
void linklist_front();
int linklist_isempty();
struct dlist {
dlist * prev;
int data;
dlist * next;
};
int dlinklist_counter = 0;
void dlinklist_insert();
void dlinklist_call();
void dlinklist_dequeu();
void dlinklist_show();
void dlinklist_front();
int main()
zee:
system("cls");
int i;
cout << "\t\t\t\t Welcome in Queue \n 1- Array \n 2- Link List \n 3- Double Link List \n 4- EXIT \n";
cin >> i;
switch (i)
case 1:
array_call();
goto zee;
case 2:
linklist_call();
goto zee;
case 3:
dlinklist_call();
goto zee;
case 4:
break;
default:
cout << " You enter invalid number PLZ Select again \n";
system("pause");
goto zee;
return 0;
void array_call()
start:
system("cls");
int input;
cout << "\n 1- Enqueu \n 2- Dequeu \n 3- Front\n 4- Show all data \n 5- Exit from Queue in Array
\n";
switch (input)
case 1:
{int z; z = isfull();
if (z)
cin >> y;
enqueue(y);
cout << " Number entered \n";
system("pause");
else
system("pause");
goto start;
break;
case 2:
{ int a; a = isempty();
if (a)
dequeue();
system("pause");
else
system("pause");
goto start;
break;
case 3:
int a; a = isempty();
if (a)
else
system("pause");
goto start;
break;
case 4:
int a; a = isempty();
if (a)
show();
else
system(" pause");
goto start;
case 5:
break;
default:
system("pause");
goto start;
break;
}
void enqueue(int x)
marks[rear] = x;
counter = counter + 1;
void dequeue()
counter = counter - 1;
int isempty()
return(counter != 0);
int isfull()
return(counter != total);
void show()
int j = front;
j++;
j = j%total;
}
//function of LINK LIST
void linklist_call()
linklist_start:
system("cls");
int input;
switch (input)
case 1:
linklist_insert();
system("pause");
goto linklist_start;
case 2:
linklist_dequeu();
goto linklist_start;
case 3:
linklist_show();
goto linklist_start;
case 4:
linklist_front();
goto linklist_start;
case 5:
break;
default:
system("pause");
goto linklist_start;
}
void linklist_insert()
c = new list;
if (linklist_counter == 0)
f = c;
p = c;
else
p->next = c;
p = c;
c->next = NULL;
linklist_counter++;
void linklist_dequeu()
if (linklist_counter == 0)
system("pause");
else
{
f = f->next;
linklist_counter--;
system("pause");
void linklist_show()
if (emp)
temp = f;
temp = temp->next;
else
system("pause");
void linklist_front()
if (emp)
else
system("pause");
int linklist_isempty()
return(linklist_counter != 0);
void dlinklist_call()
dlinklist_start:
system("cls");
int dinput;
switch (dinput)
case 1:
dlinklist_insert();
system("pause");
goto dlinklist_start;
case 2:
dlinklist_dequeu();
goto dlinklist_start;
case 3:
dlinklist_show();
goto dlinklist_start;
case 4:
dlinklist_front();
goto dlinklist_start;
case 5:
break;
default:
system("pause");
goto dlinklist_start;
void dlinklist_insert()
if (dlinklist_counter == 0)
previos = current;
first = current;
current->prev = NULL;
else
previos->next = current;
current->prev = previos;
previos = current;
current->next = NULL;
dlinklist_counter++;
void dlinklist_dequeu()
if (dlinklist_counter == 0)
system("pause");
else
first = first->next;
dlinklist_counter--;
void dlinklist_show()
if (dlinklist_counter == 0)
else
tamp = first;
{
cout << " " << tamp->data;
tamp = tamp->next;
system("pause");
void dlinklist_front()
if (dlinklist_counter == 0)
else
system("pause");
OUTPUT:
} Welcome in Queue
1- Array
2- Link List
4- EXIT