Академический Документы
Профессиональный Документы
Культура Документы
#include <iostream.h>
#include <conio.h>
#include <process.h>
class ticketqueue{
private:
//Data Members
int q[5];
public:
//Member Functions
void enqueue(int);
void ticketchecker();
void print();
int isempty();
void queuebuilder();
void menu();
};
/////////////////////
{
q[rear] = a;
rear++;
noe++;
if (rear == 5)
rear = 0;
cout<<"
"<<a<<" Is Enqeueued....."<<endl;
/////////////////////
clrscr();
int not,rt;
if ( !isempty() )
not = q[front];
if (not > 2)
rt = not - 2;
if ( rt > 0 )
enqueue(rt);
front++;
cout<<"
"<<not<<"# Tickets were demanded. 2 Tickets are
given.
"
<<"
Tickets"<<endl;
else if ( rt <= 0 )
front++;
noe--;
front++;
noe--;
cout<<"
else
cout<<"
clrscr();
menu();
/////////////////////
clrscr();
int i = front;
if ( noe > 0 )
cout<<"
do
cout<<q[i]<<" ";
i++;
if ( i == 5 )
i = 0;
while ( i != rear );
else
cout<<"
clrscr();
menu();
//////////////////
//Utility Fuction
if ( noe == 0 )
return 1;
else
return 0;
/////////////////
//This Function takes input from the user and shows Queue graphically
void ticketqueue::queuebuilder(){
clrscr();
char c;
{
if ( z > 4)
clrscr();
cout<<"
getch();
clrscr();
menu();
else
cout<<"
Enter : ";
cin>>tickets;
enqueue(tickets);
z++;
gotoxy(17,10);
cout<<"->";
gotoxy(20,9);
cout<<"----------------------------------";
gotoxy(x,y);
cout<<q[i];
x+=2;
gotoxy(20,11);
cout<<"----------------------------------";
gotoxy(g,h);
cin>>c;
h += 6;
i++;
getch();
clrscr();
menu();
//////////////////
void ticketqueue::menu()
int b;
gotoxy(15,5);
";
gotoxy(15,8);
";
gotoxy(15,11);
cout<<"Press 3................ALL TICKET REQUESTS
";
gotoxy(15,15);
cout<<"Press 4................EXIT
";
gotoxy(15,18);
cin>>b;
if ( b == 1 )
queuebuilder();
else if ( b == 2 )
ticketchecker();
else if ( b == 3 )
print();
else if ( b == 4 )
exit(1);
//////////////////
void main()
clrscr();
ticketqueue t;
t.menu();
getch();