C++ Program:

Object Oriented Programming.

C++ program for Enter patient information :

C++ program for Enter patient information and display information:

Covid patient information:

C++ program , programming,C++ program for Enter patient information


Source Code:

#include<iostream> #include<stdlib.h> using namespace std; // Patient class will be used on the place of Node class. class patient{ private: string Name,Gender;
// Bsp represnt blood sugar patient ,
// Hdp represent heard diseases patient and Cp Covid patient int Age,Bsp,Hdp,Cp; public: patient *next; // constructure called beacuse of class
// and function name is same patient() { Name=""; Gender=""; Age=0; Bsp=0; Hdp=0; Cp=0; } string getName(){ return Name; } void setName(string Name){ this->Name=Name; } string getGender(){ return Gender; } void setGender(string Gender){ this->Gender=Gender; } int getAge(){ return Age; } void setAge(int Age){ this->Age=Age; } int getBsp(){ return Bsp; } void setBsp(int Bsp){ this->Bsp=Bsp; } int getHdp(){ return Hdp; } void setHdp(int Hdp){ this->Hdp=Hdp; } int getCp(){ return Cp; } void setCp(int Cp){ this->Cp=Cp; } }; // class class Queue{ public: patient *f,*r; // This is Constructure because class
name and function name is same. Queue() { f =r = NULL; }
void addpatient
(string Name, string Gender,int Age,int Bsp,int Hdp,int Cp){ // np is object represent new patient patient *np=new patient(); np->setName(Name); np->setGender(Gender); np->setAge(Age); np->setBsp(Bsp); np->setHdp(Hdp); np->setCp(Cp); if (r==NULL) { np->next=NULL; f=r=np; } else { np->next=NULL; r->next=np; r=np; } cout<<"Patient Information Inserted"; } int isEmpty(){ return (f==NULL); } void removepatient() { int kids,female,male,age,s,h,c,ri; kids=0,female=0,male=0,age=0,s=0,h=0,c=0,ri=0; cout<<"\n......All information of patient......"<<endl; while(!isEmpty()) { if(f->getGender()=="Female" || f->getGender()=="female") { female++; } else { male++; } if(f->getAge()<15) { kids++; } else if(f->getAge()>50) { age++; } if(f->getBsp()==1) { s++; } if(f->getHdp()==1) { h++; } if(f->getCp()==1) { c++; } if(f->getCp()==1 && f->getHdp()==1 && f->getBsp()
==1 && f->getAge()>50) { ri++; } show(f); f=f->next; } cout<<"\n......Information of patient.....:\n"<<endl; cout<<"Kids Patient:"<<kids<<endl; cout<<"Female patients:"<<female<<endl; cout<<"Male patients:"<<male<<endl; cout<<"Patients have age over 50:"<<age<<endl; cout<<"Patients have blood sugar disease:"<<s<<endl; cout<<"Patients have heart disease:"<<h<<endl; cout<<"Patients have COVID19 positive:"<<c<<endl; cout<<"High-risk patients:"<<ri<<endl; } void show(patient *pr) { cout<<"\nName:"<<pr->getName()<<endl; cout<<"Age:"<<pr->getAge()<<endl; cout<<"Gender:"<<pr->getGender()<<endl; (pr->getBsp()==1)? cout<<"Blood Sugar Positive:"
: cout<<"Blood Sugar Negative"; (pr->getHdp()==1)? cout<<"\nHeart Disease Positive:"
: cout<<"\nHeart Disease Negative"; (pr->getCp()==1)? cout<<"\nCOVID Positive:"
: cout<<"\nCOVID Negative:"<<endl; } }; // main function, // execution of program started here. int main(){ string Name,Gender; int Age,Bsp,Hdp,Cp; Queue obj; char Op; cout<<"Enter patient's Information"<<endl; do { cout<<"\nName:"; cin>>Name; cout<<"Age:"; cin>>Age; cout<<"Gender:"; cin>>Gender; cout<<"Blood Sugar? 1 for positive 0 for Negative:"; cin>>Bsp; cout<<"Heart Disease? 1 for positive 0 for Negative:"; cin>>Hdp; cout<<"COVID-19? 1 for positive 0 for Negative:"; cin>>Cp; obj.addpatient(Name,Gender,Age,Bsp,Hdp,Cp);
cout<<"\nDo you Want to Enter another patient
information input y or Y for yes or N or n for not:"; cin>>Op; }while(Op=='y'|| Op=='Y'); obj.removepatient(); }