Hospital Management Application In C++ | Using OOPs C++

 Hospital Management Application In C++


We keep improving This Application: - 

#include <iostream>
using namespace std;

class Hospital
{
    public:
    int pat_id = 12223;
    char pat_name[50] ;
    char pat_gen;
    int age;
    float height;
    float weight;
    void admit()
    {
        cout<<"Admit A Patient"<<endl;
        cout<<endl;
        cout<<"Enter Patient Name"<<endl;
        cin>>pat_name;
        cout<<endl;
        while (true)
        {
            
        cout<<"Enter Age Of The Patient"<<endl;
        cin>>age;
        if(0>age>150)
        {
        cout<<"Please Enter A Valid Age"<<endl;
        continue;

        }
        else{
        break;
        }

        };
        
        cout<<endl;
        cout<<"Enter The Gender Of The Patient(m or f)"<<endl;
        cin>>pat_gen;

        cout<<endl;
        cout<<"Enter The Weight Of The Patient (in kg)"<<endl;
        cin>>weight;

        cout<<endl;
        cout<<"Enter The Height Of The Patient (in cm)"<<endl;
        cin>>height;

        cout<<"Patient Admitted Successfully"<<endl;
        cout<<"Here is the patient ID: "<<pat_id;
        cout<<endl;

    }


    void discharge()
    {
        int patientId;
        cout<<"Enter The Patient ID"<<endl;
        cin>>patientId;
        cout<<"Patient of ID No. "<<patientId<<" has been discharged from hospital"<<endl;
    }
};

int main()
{
    Hospital pat1;
    pat1.admit();
    pat1.discharge();

    return 0;
}

Comments

Popular posts from this blog

Array Of Objects In C++ | Array Of Objects Explained With Real Life Example

Pointers In C++ | Pointer Explained With Real Life Examples | Pointers In OOPs C++

Destructor In C++ | Destructor Explained With Real Life Examples