0% found this document useful (0 votes)
22 views2 pages

Patient Queue Management System Code

This C++ program defines classes for patients and queues. The patient class stores patient details like registration number, name, symptoms, and appointment date. The queue class implements a queue using linked nodes, with each node containing a patient object. The queue class methods enqueue and deque add and remove patients from the queue by inserting and outputting patient details. The main function demonstrates adding 3 patients to the queue and then removing them one by one using the queue methods.

Uploaded by

Saif khawaja
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Patient Queue Management System Code

This C++ program defines classes for patients and queues. The patient class stores patient details like registration number, name, symptoms, and appointment date. The queue class implements a queue using linked nodes, with each node containing a patient object. The queue class methods enqueue and deque add and remove patients from the queue by inserting and outputting patient details. The main function demonstrates adding 3 patients to the queue and then removing them one by one using the queue methods.

Uploaded by

Saif khawaja
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

#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->[Link](); 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->[Link](); if(ptr==front) front=NULL; else front->next = ptr->next; del_node(ptr); } }; int main() { queue s; [Link](); [Link](); [Link](); [Link](); [Link](); [Link](); return 0; }

You might also like