You are on page 1of 2

#include <iostream> #include<string> using namespace std; class patient { private: int patient_regno; string patient_name; string patient_sympton;

string appoint_date; public: patient() { patient_regno=0; patient_name=""; patient_sympton=""; appoint_date=""; } void insert() { cout<<"PLZ ENTER PATIENT cin>>patient_regno; cout<<"PLZ ENTER PATIENT cin>>patient_name; cout<<"PLZ ENTER PATIENT cin>>patient_sympton; cout<<"PLZ ENTER PATIENT cin>>appoint_date; } void output() { cout<<patient_regno<<endl; cout<<patient_name<<endl; cout<<patient_sympton<<endl; cout<<appoint_date<<endl; }

REGNO #"<<endl; NAME #"<<endl; SYMPTON #"<<endl; APPOINTMENT DATE #"<<endl;

}; class queue { private: struct node { patient s; node *next; }; public: node *ptr,*front; queue() { front=NULL; } node* get_node() { node *p; p=new node(); return p;

} void del_node (node *ptr) { delete ptr; } void enqueue() { ptr = get_node(); ptr->s.insert(); if (front==NULL) front=ptr; else ptr->next = front->next; front->next = ptr; front = ptr; } void deque() { if(front==NULL) { cout<<"QUEUE EMPTY"<<endl; } ptr=front; ptr=front->next; ptr->s.output(); if(ptr==front) front=NULL; else front->next = ptr->next; del_node(ptr); } }; int main() { queue s; s.enqueue(); s.enqueue(); s.enqueue(); s.deque(); s.deque(); s.deque(); return 0; }