#include #include #include using namespace std; struct Patient { string name; string visitReason; string address; int age; long phoneNumber; }; bool isInt(string input) { for (int i = 0; i &list) {...

1 answer below »

Build out more content by working with instance(s) of the class and the functions you created. Expand it.








#include #include #include using namespace std; struct Patient { string name; string visitReason; string address; int age; long phoneNumber; }; bool isInt(string input) { for (int i = 0; i < input.length();="" i++)="" {="" if="" (!isdigit(input[i]))="" {="" return="" false;="" }="" }="" return="" true;="" }="" void=""> &list) { string name, address, visitReason; int age; long phoneNumber; cout < "\nenter="" patient="" information"="">< endl;="" cout="">< "name:="" ";="" cin.ignore();="" getline(cin,="" name);="" cout="">< "reason="" to="" visit:="" ";="" getline(cin,="" visitreason);="" cout="">< "address:="" ";="" getline(cin,="" address);="" cout="">< "age:="" ";="" cin="">> age; cout < "phone="" number:="" ";="" cin="">> phoneNumber; Patient patient; patient.name = name; patient.address = address; patient.visitReason = visitReason; patient.age = age; patient.phoneNumber = phoneNumber; list.push_back(patient); } void displayAllPatient(vector &list) { if (list.size() ==0) { cout < "currently="" no="" patients="" in="" the="" list"="">< endl;="" }="" else="" {="" cout="">< "\npatients="" in="" the="" list"="">< endl;="" for="" (int="" i="0;" i="">< list.size();="" i++)="" {="" cout="">< "\n-------------------------------------------"="">< endl;="" cout="">< "name:="" "="">< list.at(i).name="">< endl;="" cout="">< "reason="" to="" visit:="" "="">< list.at(i).visitreason="">< endl;="" cout="">< "address:="" "="">< list.at(i).address="">< endl;="" cout="">< "age:="" "="">< list.at(i).age="">< endl;="" cout="">< "phone="" number:="" "="">< list.at(i).phonenumber="">< endl;="" }="" }="" }="" void=""> &list) { if (list.size() == 0) { cout < "currently="" no="" patients="" in="" the="" list"="">< endl;="" }="" else="" {="" string="" name;="" cout="">< "enter="" name="" of="" the="" patient:="" ";="" cin.ignore();="" getline(cin,="" name);="" bool="" found="false;" for="" (int="" i="0;" i="">< list.size();="" i++)="" {="" if="" (list.at(i).name="=" name)="" {="" cout="">< "\npatient="" information"="">< endl;="" cout="">< "name:="" "="">< list.at(i).name="">< endl;="" cout="">< "reason="" to="" visit:="" "="">< list.at(i).visitreason="">< endl;="" cout="">< "address:="" "="">< list.at(i).address="">< endl;="" cout="">< "age:="" "="">< list.at(i).age="">< endl;="" cout="">< "phone="" number:="" "="">< list.at(i).phonenumber="">< endl;="" found="true;" break;="" }="" }="" if="" (!found)="" {="" cout="">< "no="" patient="" exists="" with="" this="" name"="">< endl;="" }="" }="" }="" void=""> &list) { if (list.size() == 0) { cout < "currently="" no="" patients="" in="" the="" list"="">< endl;="" }="" else="" {="" string="" name;="" cout="">< "enter="" name="" of="" the="" patient:="" ";="" cin.ignore();="" getline(cin,="" name);="" bool="" found="false;" for="" (int="" i="0;" i="">< list.size();="" i++)="" {="" if="" (list.at(i).name="=" name)="" {="" list.erase(list.begin()="" +="" i);="" cout="">< "record="" have="" been="" deleted"="">< endl;="" found="true;" break;="" }="" }="" if="" (!found)="" {="" cout="">< "no="" patient="" exists="" with="" this="" name"="">< endl;="" }="" }="" }="" int="" main()="" {="" int="" input;="" string="" str;="" bool="" check;="" vector=""> patientList; while (true) { cout < "\n="" welcome"="">< endl;="" cout="">< "1.="" to="" add="" a="" patient"="">< endl;="" cout="">< "2.="" to="" view="" all="" patients"="">< endl;="" cout="">< "3.="" to="" view="" a="" single="" patient"="">< endl;="" cout="">< "4.="" to="" delete="" a="" patient"="">< endl;="" cout="">< "5.="" to="" exit="" the="" program"="">< endl;="" cout="">< "enter="" your="" choice:="" ";="" cin="">> str; check = isInt(str); if (check) { input = stoi(str); switch (input) { case 1: { addPatient(patientList); break; } case 2: { displayAllPatient(patientList); break; } case 3: { displaySinglePatient(patientList); break; } case 4: { deletePatient(patientList); break; } case 5: { cout < "thank="" you="" for="" using="" the="" program"="">< endl;="" exit(0);="" }="" default:="" {="" cout="">< "invalid>
Answered Same DayJun 03, 2021

Answer To: #include #include #include using namespace std; struct Patient { string name; string visitReason;...

Arun Shankar answered on Jun 04 2021
139 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here