Write a program to implement binary search algorithm on a dynamic array of objects of “patient” class. “patient” class contains attributes (privately defined) patient_id (int), pat_name (string) and pat_app_date (string). “patient” class should also contain member functions (publicly defined): constructor, input and output function. User will provide values for attributes for objects of “patient” class as input. Objects are required to be stored in array in ascending order on basis of patient_id. Binary search function should check for an object of “patient” class which will be input by user as a key value on basis of patient_id attribute. If object is found its index location in array should display, otherwise program should display a message that value is not found.
Write a program to implement binary search
“patient” class contains attributes (privately defined) patient_id (int), pat_name (string) and
pat_app_date (string). “patient” class should also contain member functions (publicly defined):
constructor, input and output function. User will provide values for attributes for objects of “patient”
class as input. Objects are required to be stored in array in ascending order on basis of patient_id. Binary
search function should check for an object of “patient” class which will be input by user as a key value
on basis of patient_id attribute. If object is found its index location in array should display, otherwise
program should display a message that value is not found.
Step by step
Solved in 4 steps with 1 images