Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CAN SOMEONE HELP ME WITH THIS void removePatient(char* patientNameInput) FUNCTION PLEASE. I tried with the following code to delete David Luiz but when I display
CAN SOMEONE HELP ME WITH THIS void removePatient(char* patientNameInput) FUNCTION PLEASE. I tried with the following code to delete "David Luiz" but when I "display" the list again, it still shows all three patient instead of two. THUMBS UP WILL BE GIVEN IF FIX CORRECTLY. THANK YOU!!
// HW7 Q4: removePatient (15 points) // This function removes a patient from the list. //Parse the list to locate the patient and delete that 'patient' node. // You need not check if the patient exists because that is done in executeAction NOTE: In Hw 8, you will need to add code to this function to remove docotrs of that patient as well, when you remove the patient. void removePatient (char* patientNameInput) struct patientList* tempList1 = list; struct patientList* tempList2 = list; // work on a copy of 'list' if(tempList1->next := NULL){ list= NULL; while(tempListi NULL) struct patient* pt = tempList1->patient; // if name exists if(strcasep (pt-mame, patientName Input) = 0){ tempList2->next tempList1->next; return; tempList2 tempList1 temp List1; tempList1->next ; = displayPatientList (10 points) CSE240 HW 7,8 lease enter your selection: W7: a: add a new patient to the list d: display patient list (no doctors) r: remove a patient q: quit HW8: c: add a doctor of a patient 1: display last added doctor of a patient b: display patient list including doctors q: quit Patient name: David Lui:z Room number: 120 Patient name: Wi1lian Borges Room number: 320 Patient name: Eden Hazard Room number: 101 (end of list) void addPatient (char* patientNameInput, unsigned int roomNumInput); // 15 points void displayPatientList (struct patientList* tempList) struct patient searchPatient (char* patientNameInput); void removePatient (char* patientNameInput); /10 points /10 points //15 points //Hw 8 void addDoctor (char* patientNameInput, char* doctorNameInput) char* lastDoctor (char patientNameInput); void displayPatientAndDoctorList(struct patientList* tempList); /edit removePatient() /15 points //15 points //10 points //10 points int main() char selection = 'a"; //initialized to a dummy value 0 printf(" nCSE240 HW 7,8 n") printf("Please enter your selection: In"); printf("HW7: In") printf("\t a: add a new patient to the listln"); printf("t d: display patient list (no doctors) "); printf("\t r: remove a patient "); printf("\t q: quitln") printf("HW8: In"); printf("t c: add a doctor of a patientIn") printf("\t 1: display last added doctor of a patientln"); printf("\t b: display patient list including doctorsIn"); printf("It q: quitin")i selection getchar); flushStdIn); executeAction (selection) while (selection! 'q') return 0 // HW7 Q4: removePatient (15 points) // This function removes a patient from the list. //Parse the list to locate the patient and delete that 'patient' node. // You need not check if the patient exists because that is done in executeAction NOTE: In Hw 8, you will need to add code to this function to remove docotrs of that patient as well, when you remove the patient. void removePatient (char* patientNameInput) struct patientList* tempList1 = list; struct patientList* tempList2 = list; // work on a copy of 'list' if(tempList1->next := NULL){ list= NULL; while(tempListi NULL) struct patient* pt = tempList1->patient; // if name exists if(strcasep (pt-mame, patientName Input) = 0){ tempList2->next tempList1->next; return; tempList2 tempList1 temp List1; tempList1->next ; = displayPatientList (10 points) CSE240 HW 7,8 lease enter your selection: W7: a: add a new patient to the list d: display patient list (no doctors) r: remove a patient q: quit HW8: c: add a doctor of a patient 1: display last added doctor of a patient b: display patient list including doctors q: quit Patient name: David Lui:z Room number: 120 Patient name: Wi1lian Borges Room number: 320 Patient name: Eden Hazard Room number: 101 (end of list) void addPatient (char* patientNameInput, unsigned int roomNumInput); // 15 points void displayPatientList (struct patientList* tempList) struct patient searchPatient (char* patientNameInput); void removePatient (char* patientNameInput); /10 points /10 points //15 points //Hw 8 void addDoctor (char* patientNameInput, char* doctorNameInput) char* lastDoctor (char patientNameInput); void displayPatientAndDoctorList(struct patientList* tempList); /edit removePatient() /15 points //15 points //10 points //10 points int main() char selection = 'a"; //initialized to a dummy value 0 printf(" nCSE240 HW 7,8 n") printf("Please enter your selection: In"); printf("HW7: In") printf("\t a: add a new patient to the listln"); printf("t d: display patient list (no doctors) "); printf("\t r: remove a patient "); printf("\t q: quitln") printf("HW8: In"); printf("t c: add a doctor of a patientIn") printf("\t 1: display last added doctor of a patientln"); printf("\t b: display patient list including doctorsIn"); printf("It q: quitin")i selection getchar); flushStdIn); executeAction (selection) while (selection! 'q') return 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started