I need help in constructing the function. Following are the given struct that can't be changed     // name structure data type     struct nameTag {         String last;         String first;     };     typedef struct nameTag nameType;     // vaccinee structure data type     struct vaccineeTag {         int ID;            // ID number of the vaccinee, note that this number is system-generated (i.e., not a user input)         nameType name;     // name of vacinee         int age;               // age of vacinee         int bool_frontliner;    // 0 means not frontliner, 1 means frontliner         int bool_comorbidity;   // 0 means no comorbidity, 1 means with comorbiditity          int priority;           // 0 means priority not yet set, 1 to 4 means priority is set                                  //   where 1 is the highest priority and 4 is the lowest priority     };     typedef struct vaccineeTag vaccineeType;       TO DO #1: Implement Search_by_Name() ( Implement a linear search algorithm to search the VACCINEE[] list if there is a matching element corresponding to the name_keyparameter. If there is a match, return the corresponding array index where it was found in the list. Otherwise, return a value of -1 toindicate that it was not found.)     @param: name_key is the search key (containing the last name and first name of the person to be searched)     @param: VACCINEE[] is the array of structures (containing info about people who will be scheduled for vaccination)     @param: n is the actual number of elements in VACCINEE[] where n <= MAXSIZE.     returns: if name_key is found, return the index where name_key was found in VACCINEE[];               otherwise, return a value of -1. */ int Search_by_Name(nameType name_key, vaccineeType VACCINEE[], int n) {     /* for          Declare your own local variables.                    Do NOT call printf() or scanf() in this function.      */ }

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.4: A Case Study: Constructing A Date Class
Problem 9E
icon
Related questions
Question

I need help in constructing the function.

Following are the given struct that can't be changed

    // name structure data type
    struct nameTag {
        String last;
        String first;
    };

    typedef struct nameTag nameType;

    // vaccinee structure data type
    struct vaccineeTag {
        int ID;            // ID number of the vaccinee, note that this number is system-generated (i.e., not a user input)
        nameType name;     // name of vacinee
        int age;               // age of vacinee
        int bool_frontliner;    // 0 means not frontliner, 1 means frontliner
        int bool_comorbidity;   // 0 means no comorbidity, 1 means with comorbiditity 
        int priority;           // 0 means priority not yet set, 1 to 4 means priority is set 
                                //   where 1 is the highest priority and 4 is the lowest priority
    };

    typedef struct vaccineeTag vaccineeType;

 

    TO DO #1: Implement Search_by_Name() ( Implement a linear search algorithm to search the VACCINEE[] list if there is a matching element corresponding to the name_keyparameter. If there is a match, return the corresponding array index where it was found in the list. Otherwise, return a value of -1 toindicate that it was not found.)

    @param: name_key is the search key (containing the last name and first name of the person to be searched)
    @param: VACCINEE[] is the array of structures (containing info about people who will be scheduled for vaccination)
    @param: n is the actual number of elements in VACCINEE[] where n <= MAXSIZE.
    returns: if name_key is found, return the index where name_key was found in VACCINEE[]; 
             otherwise, return a value of -1.
*/
int Search_by_Name(nameType name_key, vaccineeType VACCINEE[], int n)
{
    /* for 
        Declare your own local variables.        
           Do NOT call printf() or scanf() in this function. 
    */

}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr