Question: Data Structure and algorithms (singly linked list implementation using C++) This is my answer for previous question that also connected with the question 2 #include

Data Structure and algorithms (singly linked list implementation using C++)

This is my answer for previous question that also connected with the question 2

#include using namespace std;

class LinkedList { struct Node { int no; Node *next; };

public: LinkedList() { head = NULL; }

void addValue(int no) { Node *n = new Node(); Node *p; n -> no = no;

if (head == NULL) { head = n; head -> next = NULL; } else { p = head; while(p->next!=NULL) p=p->next; p->next = n; n->next=NULL; } } void display() { struct Node *iterator = head; while(iterator!=NULL) { coutno next; } } private: Node *head; };

int main() { LinkedList list; int num; char choice; do { cout > num; list.addValue(num); cout > choice; }while (choice == 'Y');

cout

THE QUESTION 2. REFERING TO SAMPLE PROGRAM THAT I HAVE ANSWER

Data Structure and algorithms (singly linked list implementation using C++) This is

my answer for previous question that also connected with the question 2

#include using namespace std; class LinkedList { struct Node { int no;

Node *next; }; public: LinkedList() { head = NULL; } void addValue(int

1. Write Hospital Admission Record program to store patient records. The information need to be stored are: i. Patient Name ii. Patient IC/ Passport No iii. Patient Contact No iv. Type of disease v. Doctor Names 2. Complete a function named dataPatient(). This function should accept all input of struct data members stated above. During the data entry process, patient should be assigned under one of doctors stated below: i. Dr Sam ii. Dr Creed iii. Dr Mike 3. Complete a function named register Patient(). This function should add/register the new patient data into existing record. 4. Complete a function named displayPatient() based on following conditions: Option 1 (individual): User will enter patient ID as input and function will display the patient details. Option 2: Function will display all patients' details in record. Sample of Program (Hospital.h) class Hospital { /ode declaration struct Patient { 1/Question 2(1) }; public: 1/initialize both head and tail pointers to NULL Hospital () { start = NULL; end = NULL; } int menu () { //display menu options //return user's choice } Patient *dataPatient () { 1/Question 2(2) //create a new node //accept user's data inputs //return address of new node to registerPatient() } void register Patient (/*suitable parameters*/) { 1/Question 2(3) //invoke dataPatient() and accept new node's address //add new node to linked list } void displayPatient (/*suitable parameters*/) { 1/Question 2(4) } private: Patient *start, *end; }; Sample of Program (Record.cpp) 1/ suitable preprocessor (header) int main() { // create class object and variables do { choice = menu(); switch (choice) { case i: //call function register Patient() case 2: //call function displayPatient () case 3: //call function update Patient () } } while (choice != 4); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!