Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data Structure Course: Write a c++ program that use the table below of compatibility blood tranfusion. The program should ask how many patients you are

Data Structure Course: Write a c++ program that use the table below of compatibility blood tranfusion. The program should ask how many patients you are going to insert in form of a array and store there information of blood type. The program should ask the patient he is a recipient or the donor and then ask for his blood type. The program should print combination if the result of the blood transfusion matches or is not compatible between patients. Which patient is doing the transfusion to the other patient and show there blood types.

image text in transcribed

Show transcribed image text

I go this code as a expert aswer but it doesn't run or work said about iostream.h declaration not found. I think maybe there are some parts missing I don't know. I try to delete every .h from the first declarations but it doesn't work either.

#include #include #include #include #include #include #include #include #include #include class DONOR { int age1; char occupation1[30],place1[30]; int weight1; int pulse1; char bp1[10]; public: int rno,donval; char name1[30],blood1[5]; void getit(int); void putit(); }; class GROUPS { public: int op,on,ap,an,bp,bn,ab; void getit(); }; class ACCEPTOR { public: int recval,rno; char name2[30],blood2[5],hosp[20]; void getit(); }; int doncrit() { int ret=0; char ch[5]; mn: clrscr(); for(int i=0;iblood pressuresimage text in transcribed are within normal limits without medication"; coutweight lossimage text in transcribed e. Diabetes-controlled on Insulin"; cout>age1; if(age1=60) { cout

int ch; lc: int n; cout>ch; switch(ch) { case 1:strcpy(blood1,"O+"); break; case 2:strcpy(blood1,"O-"); break; case 3:strcpy(blood1,"A+"); break; case 4:strcpy(blood1,"A-"); break; case 5:strcpy(blood1,"B+"); break; case 6:strcpy(blood1,"B-"); break; case 7:strcpy(blood1,"AB"); break; default:{ cout "; cout>weight1; if(weight1>pulse1; if(pulse190) { cout>ch4; switch(ch4) { case 1:strcpy(blood2,"O+"); break; case 2:strcpy(blood2,"O-"); break; case 3:strcpy(blood2,"A+"); break; case 4:strcpy(blood2,"A-"); break; case 5:strcpy(blood2,"B+"); break; case 6:strcpy(blood2,"B-"); break; case 7:strcpy(blood2,"AB"); break; default:{ cout>recval; } Jan 26, 2013 at 9:08pm nikhil m (5) void DONOR::putit() { cout>n; for(i=1;i>ch; switch(ch) { case 1:strcpy(blood1,"O+"); break; case 2:strcpy(blood1,"O-"); break; case 3:strcpy(blood1,"A+"); break; case 4:strcpy(blood1,"A-"); break; case 5:strcpy(blood1,"B+"); break; case 6:strcpy(blood1,"B-"); break; case 7:strcpy(blood1,"AB"); break; default:{ cout

while(pfile.read((char *)&p,sizeof(p))) { if(strcmp(p.blood1,blood1)==0) { cout>ch; switch(ch) { case 1:srchnm1(); clrscr(); break; case 2:srchbg1(); clrscr(); break; case 3:break; } }while(ch==1 || ch==2); } void deletefile() { ifstream pfile; ofstream tempfile; DONOR s; char ch[30]; pfile.open("BLOODDONATION.dat",ios::binary); tempfile.open("Nashtemp.dat",ios::binary); cout : "; gets(ch); while(pfile.read((char*)&s,sizeof(s))) { if(strcmpi(ch,s.name1)!=0) { tempfile.write((char*)&s,sizeof(s)); } } pfile.close(); tempfile.close(); remove("BLOODDONATION.dat"); rename("Nashtemp.dat","BLOODDONATION.dat"); } void modfile() { ifstream pfile; ofstream tempfile; DONOR s; char ch[30]; int no; pfile.open("BLOODDONATION.dat",ios::binary); tempfile.open("Nashtemp.dat",ios::binary); cout>no; while(pfile.read((char*)&s,sizeof(s))) { if(s.rnono) { tempfile.write((char*)&s,sizeof(s)); } } pfile.close(); tempfile.close(); remove("BLOODDONATION.dat"); rename("Nashtemp.dat","BLOODDONATION.dat"); } void makdon() { fstream pfile; ofstream mfile; DONOR p; GROUPS q; int don; char name[30]; pfile.open("BLOODDONATION.dat",ios::binary|ios::in|ios::out); mfile.open("BLOODGROUPS.dat",ios::app); cout>don; if(don100) { cout

void avbld() { clrscr(); ifstream mfile; mfile.open("BLOODGROUPS.dat"); GROUPS m; mfile.read((char *)&m,sizeof(m)); coutp.op) { ret=0; } else { ret=1; } } if(strcmp(i.blood2,"O-")==0) { if(i.recval>p.on) { ret=0; } else { ret=1; } } if(strcmp(i.blood2,"A+")==0) { if(i.recval>p.ap) { ret=0; } else { ret=1; } } if(strcmp(i.blood2,"A-")==0) { if(i.recval>p.an) { ret=0; } else { ret=1; } } if(strcmp(i.blood2,"B+")==0) { if(i.recval>p.bp) { ret=0; } else { ret=1; } } if(strcmp(i.blood2,"B-")==0) { if(i.recval>p.bn) { ret=0; } else { ret=1; } } if(strcmp(i.blood2,"AB")==0) { if(i.recval>p.ab) { ret=0; } else { ret=1; } } if(ret==0) { cout=10;li--) { gotoxy(li,22); delay(30); printf("\\"); } for(int lp=16;lp=16;lp--) { gotoxy(70,lp); delay(100); printf("-"); } gotoxy(12,17); textcolor(BLINK + MAGENTA); cprintf(" Welcome To LIFELINE Blood Bank Computer System "); gotoxy(12,20); cprintf(" Designed and Coded By Nash Technologies (C) 2012-13"); gotoxy(31,28); textcolor(LIGHTGREEN); cprintf("Programmed By"); gotoxy(30,31); textcolor(11); cprintf(" Nikhil And Christy "); gotoxy(44,48); textcolor(WHITE); cprintf("Press Any Key To ..........Continue"); getch();

clrscr(); } void pagedes() { for(int i=0;i"; } for(i=0;i

textbackground(LIGHTRED); textcolor(LIGHTGRAY); gotoxy(2,3); cout>>>>>>>>>>>"; gotoxy(2,5); cout>ch; switch(ch) { case 1:strcpy(status," Donor"); break; case 2:strcpy(status," Acceptor"); break; case 3:exit(0); default:{ cout "; cout

} if(strcmp(status," Donor")==0) { p=doncrit(); if(p==1) { goto lb; } else { go1: do { clrscr(); pagedes(); cout donor information "; cout>ch2; switch(ch2) { case 1:Insertfile(); break; case 2:searchfile(); break; case 3:modfile(); break; case 4:deletefile(); break; case 5:filedisplay(); break; case 6:makdon(); break; case 7:avbld(); break; case 8:clrscr(); goto lb; case 9:exit(0); default : { cout

} getch(); } if(strcmp(status," Acceptor")==0) { clrscr(); int ch3,t; do { clrscr(); pagedes(); cout>ch3; switch(ch3) { case 1:accblddisp(); break; case 2:{ insaccpt(); t=chaccpt(); if(t==0) goto lb; break; } case 3:{ prcpt(); break; } case 4:clrscr(); goto lb; case 5:exit(0); clrscr(); } } while(ch3==1||ch3==2||ch3==3); } }

RED BLOOD CELL COMPATIBILITY TABLE Donor O- O+ A A+ B- B+ AB- AB+

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions