Hospital Managment System in C++

#include<iostream>
#include<conio.h>
#include<fstream>
#include<string>
#include<stdio.h>

using namespace std;

class all
{
public:
string name;
string f_name;
string b_group;
string pt_id;
int age;
char option;

void info_get();
void show_data();
void search();


} s1;

void all::info_get()
{
   

cout<<"\n****************Enter info of paitent**************\n";
cout<<"enter name\n";
cin>>name;
cout<<"father name\n";
cin>>f_name;
cout<<"patient ID\n";
cin>>pt_id;
cout<<"patient Age\n";
cin>>age;



}

void all::show_data()
{
    string line;
    ifstream x;
    x.open("info.txt");
    while(!x.eof())
    {
    getline(x,line);
    cout<<line;
    }

    cout<<"\n****************paitent Info**************\n";

cout<<"Paitent name\n"<<name<<endl;
cout<<"Paitent father name\n"<<f_name<<endl;
cout<<"patient ID\n"<<pt_id<<endl;
cout<<"patient Age\n"<<age<<endl;

}   


void all::search()
{
    all st1;
    char nm[10];
    ifstream fin;
    cout<<"Enter the neme you want to search\n";
    cin>>nm;
    while(!fin.eof())
    {
    ifstream fin;
    fin.read((char*)&st1,sizeof(st1));
    if(name==nm)
    {
        st1.show_data();
}
   
   
else
{
cout<<"not found\n";
}
    }
}


void main()
{
all y;
int choise;
string line;
do
{
    ifstream x;
x.open("info.txt");
x>>"Paitent name\n">>y.name;
x>>"Paitent father name\n">>y.f_name;
x>>"patient ID\n">>y.pt_id;
x>>"patient Age\n">>y.age;
x.close();
cout<<"\n 1.entery of paitent \n 2.info of paitent \n 3.search by name \n 4.exit \n input choise \n";
cin>>choise;
if(choise==1)
{
    y.info_get();
}
if(choise==2)
{
    x.open("info.txt");
    while(!x.eof())
    {
    getline(x,line);
    cout<<line;
    }

   
    y.show_data();
   
}
if(choise==3)
{
    y.search();

}

}
while(choise!=4);
{
cout<<"exiting";
}

getch();

}

No comments:

Post a Comment