Question: int search ( const college a [ 1 , unsigned n , string name, string category ) ; This function takes four parameters: The first

int search(const college a[1, unsigned n, string name, string category);
This function takes four parameters:
The first is an array of College objects.
The second is the number of array elements to be searched.
The third is to identify the College name of interest.
The fourth is to identify the data of interest.
The function is to search the first n elements of the College array and return the related data in the given College under the given category. If no match is found, the function shall return a negative value.
The focus of the function is to retum a value. While you might find it helpful to add output statements in the function to help see intermediate values of local variables, the function shall not include any output statements when you are ready to capture screenshots of the testing for this function. To demonstrate testing of this function, you will need to make several calls to the search function and display respective results in the main function. Here is a sample testing code segment:
cout "InThe acceptance rate of University of California Los Angeles is ";
cout search(tist,n, "University of Callfornta Los Angeles", "rate")&.";
For the function call to the search function in the above code segment:
The first argument is an array of College objects with the initial data.
The second argument is the number of colleges in the array.
The third argument indicates "University of California Los Angeles" is the College of interest.
The fourth argument indicates "rate" or exchange_rate is the data of interest.
The output generated by the above test code is provided below:
The acceptance rate of University of California Los Angeles is 118.
void sort_by_name (College a[], unsigned n);
void sort_by_cost(College a[], unsigned n);
void sort_by_living (College a[], unsigned n);
 int search(const college a[1, unsigned n, string name, string category); This

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!