PROMOTE MY BLOG: JUST CLICK BELOW BUTTON

Search Any Paper On This Blog

Tuesday, November 20, 2012

Re: ::: vuaskari.com ::: cs 301 ki assignment chaiyan

#include<iostream>
#include<cstdlib>
#define MAX_SIZE 10
using namespace std;

class Queue
{
private:

string item[MAX_SIZE];
int rear;
int front;
public:
Queue();
void enqueue(string);
string dequeue();
int size();
void display();
bool isEmpty();
bool isFull();
};


Queue::Queue()
{
rear = -1;
front = 0;
}

void Queue::enqueue(string data)
{
item[++rear] = data;
}


string Queue::dequeue()
{
return item[front++];
}


void Queue::display()
{
if(!this->isEmpty()){
for(int i=front; i<=rear; i++)
coutitem[i]endl;
}

else
{
cout"Queue Underflow"endl;
}
}


int Queue::size()
{
return (rear - front + 1);
}


bool Queue::isEmpty()
{
if(front>rear)
{
return true;
}
else{
return false;
}
}
bool Queue::isFull()
{
if(this->size()>=MAX_SIZE)
{
return true;
}
else{
return false;
}
}


int main()
{
Queue queue;
int choice;
string data;
while(1){
cout"\n1.for Add Customer in Queue\n2.for Remove Customer from Queue\n3.for Queue Size\n4.for Display all element\n5.for Quit";
cout"\nEnter your choice: ";
cin>>choice;
switch(choice)
{
case 1:
if(!queue.isFull())
{
cout"\n Enter name: ";
cin>>data;
queue.enqueue(data);
}
else
{
cout"Queue is Full"endl;
}
break;
case 2:
if(!queue.isEmpty()){
cout"The data dequeued is :"queue.dequeue();
}
else
{
cout"Queue is Emtpy"endl;
}
break;
case 3:
cout"Size of Queue is "queue.size();
break;
case 4:
queue.display();
break;
case 5:
exit(0);
break;
}
}
}

Read more: ASSIGNMENT#3 CS301 - Data structures Solution & Dicussion Fall Semester 2012 Due Date:19-11-2012 - Virtual University of Pakistan http://vustudents.ning.com/forum/topics/assignment-3-cs301-data-structures-fall-semester-2012?groupUrl=cs301datastructures&groupId=3783342%3AGroup%3A59340&id=3783342%3ATopic%3A1805290&page=11#comments#ixzz2CmyrRA36



On Tue, Nov 20, 2012 at 10:52 PM, furry jan <farooqfurry@gmail.com> wrote:

--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en
 
 

--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en
 
 

No comments:

Post a Comment

PLEASE COMMENT ABOUT YOUR VISIT AND MY SITE

Note: Only a member of this blog may post a comment.