?? hospital sys01.cpp
字號:
if(d==5)
strcpy(ward,"emergency");
if(d==6)
strcpy(ward,"recovery");
}
};
////////////opens files for writing//////////
void inp2()
{
textcolor(5);
clrscr();
fstream o,ad;
patient p;
addr a1;
int c,rec,flag,j=0;
char a;
ad.open("addr.txt",ios::in|ios::out|ios::app|ios::binary);
o.open("hospital.txt",ios::in|ios::out|ios::app|ios::binary);
do
{
o.read((char *)&p,sizeof(patient));//View Data
if(!o)
break;
else
j=p.n;
}while(o);
o.close();
o.open("hospital.txt",ios::in|ios::out|ios::app|ios::binary);
do
{
clrscr();
p.inp1();
p.n=++j;
o.write((char*)&p,sizeof(patient));//Inputing data
label5:cout<<"\t\t\tDo you want to add patient's address(y/n): ";
cin>>a;
if(a!='y'&a!='Y'&a!='n'&a!='N')
goto label5;
else
goto label8;
label7:cout<<"\t\t\tDo you want to add another patient?(y/n): ";
cin>>a;
saveload(1);
}while(a=='y'||a=='Y');
o.seekg(0);
o.close();
if(j==0)
{
label8:if(a=='y'|a=='Y')
{
a1.addrset();
a1.n=j;
ad.write((char*)&a1,sizeof(addr));
}
else if(a=='n'|a=='N')
{
a1.addrnull();
a1.n=j;
ad.write((char*)&a1,sizeof(addr));
}
goto label7;
}
ad.close();
};
///////////opens files for outputting///////////
void out2()
{
textcolor(6);
saveload(2);
clrscr();
fstream o;
o.open("hospital.txt",ios::in|ios::out|ios::app|ios::binary);
patient p;
do
{
clrscr();
o.read((char *)&p,sizeof(patient));//View Data
if(!o)
break;
else
cout<<"\n\n\n";
p.out1();
cout<<"\n\t\t\tPress any key to continue";
box();
getch();
}while(o);
o.close();
};
/////////////checks various variables and sets bill////////////
long float billset(int adays,int d,int s,int w)
{
float bill,f=0;
if(s==1)
f=f+0.2;
if(s==2||s==6)
f=f+0.5;
if(s==3)
f=f+0.75;
if(s==4)
f=f+0.1;
if(s==5)
f=f+1.5;
if(w==1)
f=f+0.1;
if(w==2)
f=f+2;
if(w==3||w==4||w==6)
f=f+1.5;
if(w==5)
f=f+2.5;
if(d==1||d==2)
f=f+3;
if(d==3)
f=f+2.5;
if(d==4||d==5)
f=f+1.5;
if(d==6)
f=f+2;
bill=adays*1000*f;
return(bill);
};
//////////inputs data into class 'addr'///////////
void addr::addrset()
{
clrscr();
int x=4;
cout<<"\n\n\n\t\t\tEnter house no.(char included): ";
box(4);
gotoxy(56,x);
gets(hno);
cout<<"\t\t\tEnter colony/society name: ";
box(4);
gotoxy(51,++x);
gets(col);
cout<<"\t\t\tEnter city: ";
box(4);
gotoxy(36,++x);
gets(city);
cout<<"\t\t\tEnter state: ";
box(4);
gotoxy(37,++x);
gets(state);
cout<<"\t\t\tEnter country of origin: ";
box(4);
gotoxy(49,++x);
gets(country);
cout<<"\t\t\tEnter zip(6 int): ";
box(4);
gotoxy(42,++x);
cin>>zip;
cout<<"\t\t\tEnter patient history: ";
box(4);
gotoxy(49,++x);
gets(history);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -