?? hospital sys01.cpp
字號:
};
/////////sets data in class 'addr' if no data is entered////////////
void addr::addrnull()
{
strcpy(hno,"NA");
strcpy(col,"NA");
strcpy(city,"NA");
strcpy(state,"NA");
strcpy(country,"NA");
strcpy(history,"NA");
zip=0;
};
//////////view data in class 'addr'///////////
void addr::view()
{
clrscr();
cout<<"\n\n\n\t\t\tADDRESS\n";
cout<<"\t\t\tRecord No. "<<n;
cout<<"\n\t\t\t";
puts(hno);
cout<<"\t\t\t";
puts(col);
cout<<"\t\t\t";
puts(city);
cout<<"\t\t\t";
puts(state);
cout<<"\t\t\t";
puts(country);
cout<<"\t\t\t";
cout<<zip;
cout<<"\n\t\t\t";
puts(history);
box();
};
/////////////deletes patient address and history///////////
void addrd(long int i)
{
addr a;
fstream o,d;
d.open("temp2.txt",ios::in|ios::out|ios::binary);
o.open("addr.txt",ios::in|ios::out|ios::binary);
do
{
o.read((char*)&a,sizeof(addr));
if(!o)
break;
else if(a.n!=i)
d.write((char*)&a,sizeof(addr));
}while(o);
o.close();
d.close();
remove("addr.txt");
rename("temp2.txt","addr.txt");
};
/////////////modifys patient address and history/////////////
void modifya(long int rec)
{
fstream o;
addr p;
o.open("addr.txt",ios::in|ios::out|ios::binary);
o.seekg(((rec-1)*sizeof(addr)),ios::beg);
o.read((char*)&p,sizeof(addr));
cout<<"\n\n\n\t\t\tPresent values are: "<<endl;
box();
p.view();
getch();
clrscr();
cout<<"\t\t\tEntering New Values:(press any key) "<<endl;
getch();
o.seekp(((rec-1)*sizeof(addr)),ios::beg);
p.addrset();
o.write((char*)&p,sizeof(addr));
o.seekg(0);
o.close();
};
/////////displays data in class 'addr' in modify option//////////////
void patient::out3()
{
clrscr();
gotoxy(1,13);
char a;
cout<<"\n\n\n\t\t\tRecord No.: "<<n<<endl;
cout<<"\t\t\tRecord Status: ";
puts(status);
cout<<"\t\t\tName: ";
puts(name);
cout<<"\t\t\tDisease: ";
puts(disease);
cout<<"\t\t\tStatus: ";
puts(cond);
cout<<"\t\t\tDays admitted :"<<adays<<endl;
cout<<"\t\t\tAttending doctor: ";
puts(doctor);
cout<<"\t\t\tPresently Lying in ward "<<ward<<" bed "<<bed<<endl;
cout<<"\t\t\tBill to be paid: "<<bill<<endl;
gotoxy(0,0);
};
/////////////main search menu///////////
void searchmain()
{
label10:textcolor(3);
clrscr();
fstream o;
char str[20];
long int rec;
patient p;
int flag,flag1;
o.open("hospital.txt",ios::in|ios::out|ios::app|ios::binary);
clrscr();
int s;
cout<<"\n\n\n\t\t\tSEARCH MENU "
<<"\n\t\t\tSearch By"
<<"\n\t\t\t1.Record no."
<<"\n\t\t\t2.Patient Name"
<<"\n\t\t\t3.Disease"
<<"\n\t\t\t4.Attending Doctor"
<<"\n\t\t\t5.Ward"
<<"\n\t\t\t6.Return to MAIN MENU"
<<"\n\t\t\tEnter choice: ";
box();
gotoxy(40,12);
cin>>s;
clrscr();
if(s==1)
{
cout<<"\n\n\n\t\t\tEnter record no.: ";
box();
gotoxy(43,4);
cin>>rec;
saveload(4);
do
{
clrscr();
o.read((char*)&p,sizeof(patient));
if(!o)
break;
if(rec==p.n)
{
p.out1();
box();
getch();
flag=1;
break;
}
}while(o);
if(flag!=1)
cout<<"\n\n\n\t\t\tFile not found";
box();
goto label10;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -