⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hospital sys01.cpp

📁 C++语言写的basic医院系统
💻 CPP
📖 第 1 页 / 共 5 页
字号:
                                                                                            		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 + -