FIX THE ERRORS ON MY C++ PROGRAM. MAKE SURE IT CAN COMPILE AND RUN! PLEASE ATTEND TO THIS QUESTION IMMEDIATELY!! #includ

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

FIX THE ERRORS ON MY C++ PROGRAM. MAKE SURE IT CAN COMPILE AND RUN! PLEASE ATTEND TO THIS QUESTION IMMEDIATELY!! #includ

Post by answerhappygod »

FIX THE ERRORS ON MY C++ PROGRAM. MAKE SURE IT CAN COMPILE AND
RUN! PLEASE ATTEND TO THIS QUESTION IMMEDIATELY!!
#include<bits/stdc++.h>
#include<conio.h>
using namespace std;
//Storing the details of patients
long long ID;
string firstName;
string lastName;
int age;
char bloodGrp[5];
char gender;
class patientDetails*next;
class linkedqueue
{
class patientsDetails*head,*last;
public:


linkedqueue();
class head =NULL;
class last =NULL
}

{
patientDetails input();
void InsertEnd();
void InsertBegin();
void getpatientDetailsout();
void listofpatientDetailss();
int search(int);
char departmentname[50];
}
int linkedqueue :: search(int item)
{
if(head==NULL)
return false;
else
{
int flag=0;
patientDetails*p=new
patientDetails();
p=head;

while(p->next!=NULL
&& p->ID!=item)
{

p=p->next;

}
if(p->ID==item)
{
flag=1
return true;
}
if(flag++0)
return false;
}
int readNum()
{
char b[20];
cin.getline(b, sizeof(b));
return atoi(b);
}
patientsDetails linkedqueue :: input()
{
int flag=0;
patientDetails*p=new patientDetails();
cout<<"\n Please data for
patientDetails\n";
cout<<"\n First name:";
getline(cin,p->firstname);
cout<<"Last name:";
getline(cin,p->lastName);
again:
cout<<"Blood
Group:";

cin>>p->bloodGrp;
if((strcmp(p->bloodGrp,
"A+")==0)||(strcmp(p->bloodGrp,"a+")==0)||(strcmp(p->bloodGrp,"A-")==0)||(strcmp(p->bloodGrp,"a-")==0)||


((strcmp(p->bloodGrp,
"B+")==0)||(strcmp(p->bloodGrp,"b+")==0)||(strcmp(p->bloodGrp,"B-")==0)||(strcmp(p->bloodGrp,"b-")==0)||


((strcmp(p->bloodGrp,
"O")==0)||(strcmp(p->bloodGrp,"o")==0)||(strcmp(p->bloodGrp,"o-")==0)||(strcmp(p->bloodGrp,"o-")==0)||


((strcmp(p->bloodGrp,
"AB-")==0)||(strcmp(p->bloodGrp,"ab+")==0)||(strcmp(p->bloodGrp,"AB-+")==0)||(strcmp(p->bloodGrp,"ab-")==0)||

}
if(flag==0)
{
cout<< Invalid bloodGrp Group Try
Again..;
goto again;
}
cout<<" Gender(m/f):";
cin>>p->gender;
cout>>"Age:";
cin>>p->age;
cout<<"Mobile number:";
cin>>p->ID;
if(search(p->ID))
{
p->ID=0;
cout<<"\n Data not valid. Operation
cancelled.";
}
return *p;
{
void output(patientDetails *p)
{
cout<<"\n
patientDetails data:\n";
cout<<"\n First
Name:"<<p->firstName;
cout<<"\n Last
Name:"<<p->lastName;
cout<<"\n
Gender:"<<p->gender;
cout<<"\n
Age:"<<p->age;
cout<<"\n bloodGrp
Group:"<<p->bloodGrp;
cout<<"\n Mobile
Number:"<<p->ID;
}
void linkedqueue :: InsertBegin()
{
patientDetails*p=new patientDetails();
*p=input();
if(p->ID==0)
return;

if(head==NULL)
}
{
head=p;
last=p;
p->next=NULL;
}
else
{
p-?next=head;
head=p;
}
}
system("cls");
cout<<"\n\tpatientDetails added:";
output(p);
}
void linkedqueue :: InsertEnd()
{
patientDetails*p= new patientDetails();
*p=input();
if(p->ID==0)
return;

if(head== NULL)
{
head=p;
last=p;
p->next=NULL;
}
else
{
p->next=NULL;
last->next=p;
last=p;
}
system("cls");
cout<<"\n
\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcdxcd\xcd\xcd\xcd\xcd\xcd\xcd";

cout<<"\n |-- HOSPITAL MANAGEMENT
SYSTEM --|";
cout<<"\n
\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcdxcd\xcd\xcd\xcd\xcd\xcd\xcd";

} cout<<"\n ---------patientDetails
ADDED---------";
output(p);
}
void linedqueue :: getpatientDetailsout()
{
system("cls");
if(head=NULL)
{
cout<<"\n No
patientDetais to opertate";
}
else
{
patientDetails*p=new
patientDetails();
p=head;
head=head->next;
cout<<"\n
patientsDetails to operate:";
output(p);
}
}
void linkedqueue :: listofpatientDetailss()
{
if(head==NULL)
}
{
cout<<"\n No patientDetails";

}
system("cls");
cout<<"\n
\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcdxcd\xcd\xcd\xcd\xcd\xcd\xcd";

cout<<"\n |-- HOSPITAL MANAGEMENT SYSTEM --|";
cout<<"\n
\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcdxcd\xcd\xcd\xcd\xcd\xcd\xcd";

patientsDetails*p=new patientDetails;
p=head;
while(p!=NULL)
{
cout<<"\n patientDetails data:\n";
cout<<"\n First
Name:"<<p->firstName;
cout<<"\n Last
Name:"<<p->lastName;
cout<<"\n
Gender:"<<p->gender;
cout<<"\n
Age:"<<p->age;
cout<<"\n bloodGrp
Group:"<<p->bloodGrp;
cout<<"\n Mobile
Number:"<<p->ID;
cout<<"\n\n
\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcdxcd\xcd\xcd\xcd\xcd\xcd\xcd";

p=p->next;
}
cout<<"\n";
}
void departmentmenu (linkedqueue * q)
{
int choice = 0, success;
patientDetails p;
while(choice ! = 5)
{
system("cls");
cout<<"\n
|--HOSPITAL MANAGEMENT SYSTEM--|";
cout<<"\n\n
"<<q->departmentname;
cout<<"\n [1} Add
normal patientDetails\n";
cout<<"\n [2} Add
critically ill patientDetails\n";
cout<<"\n [3} Take
patientDetails to Doctor\n";
cout<<"\n [4} Display
list\n";
cout<<"\n [5} Change
Department or Exit\n";
cout<<"Please enter
your choice:";
choice=readNum();

switch(choice)

{
case 1:
q->InsertEnd();

cout<<"\n Press any key";

getch();

break;

case 2:
q->InsertBegin();

cout<<"\n Press any key";

getch();

break;

case 3:
q->getpatientDetailsout();

cout<<"\n Press any key";

getch();

break;

case 4:
system("cls");

q->listofpatientDetailss();

cout<<"\n Press any key";

getch();

break;
}
int main()

int i,choice = 0;
linkedqueue dept[4];

while(choice!=5)
{

strcpy(dept[0].departmentname, "GENERAL CLINIC\n");

strcpy(dept[1].departmentname, "HEART CLINIC\n");

strcpy(dept[2].departmentname, "LUNG CLINIC\n");

strcpy(dept[3].departmentname, "PLASTIC SURGERY\n");

system("cls");

cout<<"\n |-- HOSPITAL MANAGEMENT SYSTEM
--|";
for (i =
0; i < 4; i++ )
{

cout<<"
"<<(i+1)<<":"<<dept.departmentname;
}

cout<<" 5: Exit";

cout<<"\n\n Please enter your choice:";

choice=readNum();

if(choice>1 && choice<=4)
{

departmentmenu(&dept[choice-1]);
}
}
if(choice==5)
cout<<"\n\t\tThanks !
\n";
exit(0);




}
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply