📄 person.cpp
字号:
#include<iostream.h>
#include<string.h>
#include"person.h"
void person::input() //输入个人信息及确定挂号单编号
{
number=number++; //确定你的编号
cout<<"Your number is:GFSZB"<<number<<endl; //输出你的编号
loop1: cout<<"please choose your sex:m(man) or w(women)" <<endl;
cout<<"Sex:";
cin>>sex;
if(sex!='m'&&sex!='w') //输入错误信息请重新输入
{
cout<<"*******************************************"<<endl;
cout<<"error,please choose again"<<endl;
cout<<"*******************************************"<<endl;
goto loop1;
}
loop2: cout<<"1 is the formal medical-room:price(5 yuan)"<<endl;
cout<<"2 is the expert medical-room:price(10 yuan)"<<endl;
cout<<"please choose room-number:";
cin>>money;
if(money!=1&&money!=2) //输入错误信息请重新输入
{
cout<<"*******************************************"<<endl;
cout<<"error,please choose again"<<endl;
cout<<"*******************************************"<<endl;
goto loop2;
}
loop3:cout<<"please enter your age:"<<endl;
cout<<"Age:";
cin>>age;
if(age<=0||age>=150) //输入错误信息请重新输入
{
cout<<"*******************************************"<<endl;
cout<<"error,please enter again"<<endl;
cout<<"*******************************************"<<endl;
goto loop3;
}
loop4:cout<<"please choose the name of room:"<<endl;
cout<<"1:内科;2:外科;3:骨科;4:皮肤科;5:口腔科"<<endl;
cout<<"room:";
cin>>room;
if(room!=1&&room!=2&&room!=3&&room!=4&&room!=5) //输入错误信息请重新输入
{
cout<<"*******************************************"<<endl;
cout<<"error,please choose again"<<endl;
cout<<"*******************************************"<<endl;
goto loop4;
}
}
void person::output() //统计普通门诊与专家门诊的人数
{
switch(money)
{
case 1:
{
++c6;
}break;
case 2:
{
++c7;
}break;
}
switch (room) //根据你个人的信息,输出你将进入哪个科室
{
case 1:
cout<<"**********************************************************************"<<endl;
cout<<" Welcome to 内科 to be treated"<<endl;
break;
case 2:
cout<<"******************************"<<endl;
cout<<" Welcome to 外科 to be treated"<<endl;
break;
case 3:
cout<<"******************************"<<endl;
cout<<" Welcome to 骨科 to be treated"<<endl;
break;
case 4:
cout<<"******************************"<<endl;
cout<<"Welcome to 皮肤科 to be treated"<<endl;
break;
case 5:
cout<<"******************************"<<endl;
cout<<"Welcome to 口腔科 to be treated"<<endl;
break;
}
cout<<"**********************";
}
void person::count() //统计各科人数
{
switch(room)
{
case 1:c1++;break;//统计内科的人数
case 2:c2++;break;//统计外科的人数
case 3:c3++;break;//统计骨科的人数
case 4:c4++;break;//统计皮肤科人数
case 5:c5++;break;//统计口腔科人数
}
c8=5*c6+10*c7;
cout<<"总收入::"<<c8<<endl;
cout<<"*********************"<<endl;
cout<<"The population of 内科 is :"<<c1<<endl;
cout<<"The population of 外科 is :"<<c2<<endl;
cout<<"The population of 骨科 is :"<<c3<<endl;
cout<<"The population of 皮肤科 is :"<<c4<<endl;
cout<<"The population of 口腔科 is :"<<c5<<endl;
cout<<"************************"<<endl;
}
void person::roomone() //统计内科科室中各诊室的人数
{
if(room==1&&age>0&&age<=14)
{
b1=++b1;
}
if(room==1&&age>14&&age<=25&&sex=='m')
{
b2=++b2;
}
if(room==1&&age>14&&age<=25&&sex=='w')
{
b3=++b3;
}
b4=b2+b3;
if(room==1&&age>25)
{
b5=++b5;
}
cout<<"第一科室"<<b1<<endl;
cout<<"第二科室"<<b2<<endl;
cout<<"第三科室"<<b3<<endl;
cout<<"第四科室"<<b5<<endl;
}
void person::roomall() //统计各个科室中各个年龄段人数
{
if(room==2&&age>0&&age<=14)
{
b6=++b6;
}
if(room==2&&age>14&&age<=25)
{
b7=++b7;
}
if(room==2&&age>25)
{
b8=++b8;
}
if(room==3&&age>0&&age<=14)
{
b9=++b9;
}
if(room==3&&age>14&&age<=25)
{
b10=++b10;
}
if(room==3&&age>25)
{
b11=++b11;
}
if(room==4&&age>0&&age<=14)
{
b12=++b12;
}
if(room==4&&age>14&&age<=25)
{
b13=++b13;
}
if(room==4&&age>25)
{
b14=++b14;
}
if(room==5&&age>0&&age<=14)
{
b15=++b15;
}
if(room==5&&age>14&&age<=25)
{
b16=++b16;
}
if(room==5&&age>25)
{
b17=++b17;
}
cout<<"******************************";
}
void person::bili()
{
if(room==1) //统计内科各个年龄段所占的比例
{
cout<<"内科的各年龄段统计比例"<<endl;
cout<<"14岁以下所占比例为:"<<b1<<"/"<<c1<<endl;
cout<<"14到25岁所占比例为:"<<b4<<"/"<<c1<<endl;
cout<<"25岁以上所占比例为:"<<b5<<"/"<<c1<<endl;
}
if(room==2)
{ //统计外科各个年龄段所占的比例
cout<<"外科的各年龄段统计比例"<<endl;
cout<<"14岁以下所占比例为:"<<b6<<"/"<<c2<<endl;
cout<<"14到25岁所占比例为:"<<b7<<"/"<<c2<<endl;
cout<<"25岁以上所占比例为:"<<b8<<"/"<<c2<<endl;
}
if(room==3) //统计骨科各个年龄段所占的比例
{
cout<<"骨科的各年龄段统计比例"<<endl;
cout<<"14岁以下所占比例为:"<<b9<<"/"<<c3<<endl;
cout<<"14到25岁所占比例为:"<<b10<<"/"<<c3<<endl;
cout<<"25岁以上所占比例为:"<<b11<<"/"<<c3<<endl;
}
if(room==4) //统计皮肤科各个年龄段所占的比例
{
cout<<"皮肤科的各年龄段统计比例"<<endl;
cout<<"14岁以下所占比例为:"<<b12<<"/"<<c4<<endl;
cout<<"14到25岁所占比例为:"<<b13<<"/"<<c4<<endl;
cout<<"25岁以上所占比例为:"<<b14<<"/"<<c4<<endl;
}
if(room==5) //统计口腔科各个年龄段所占的比例
{
cout<<"口腔科的各年龄段统计比例"<<endl;
cout<<"14岁以下所占比例为:"<<b15<<"/"<<c5<<endl;
cout<<"14到25岁所占比例为:"<<b16<<"/"<<c5<<endl;
cout<<"25岁以上所占比例为:"<<b17<<"/"<<c5<<endl;
}
cout<<"********************************************************************************";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -