Question: This program is IN THE C LANGUAGE! I WILL THUMBS UP THE ANSWER IF CORRECT!!:) PLEASE USE THE PROVIDED FUNCTIONS GIVEN BELOW! Please if possible,
This program is IN THE C LANGUAGE! I WILL THUMBS UP THE ANSWER IF CORRECT!!:)
PLEASE USE THE PROVIDED FUNCTIONS GIVEN BELOW! Please if possible, have comments within the code!
(This program will use this struct for recording employees info):
struct employee {
int number;
char employee_name[20];
};
The first function in this program that is needed will search for a specific employee number (in an array of employees). If an employee is found with the employee number that was searched, the bool value "true" will be returned to main and the found_employee variable will be set to the employee name that was found. If the employee number was not found in the array, the bool value "false" will be returned to main. This function will be ran O (n) times in the worst case scenario, and O (1) times in the best case scenario (n is the number of employees) in the array.
Here is the prototype of this function, please keep it exactly as it is below:
bool find_number(int number, struct employee arr[], int n, char * found_employee);
Another function also needs to be created, however it will do the reverse of the 1st function (search for an employee name, not employee number). If an employee is found with the employee name that was searched, the bool value "true" will be returned to main and the numbers[] variable will be set to the employee number that was found. If the employee name was not found in the array, the bool value "false" will be returned to main. If more than one employee is found with the same name (as the one being searched), the employee IDs of all the employees with this name will be saved in the numbers[] array. This function will be ran O (n) times in the worst case scenario, and O (1) times in the best case scenario (n is the number of employees) in the array.
Here is the prototype of this function, please keep it exactly as it is below:
int find_employee(char * employee_name , struct employee arr[], int n, int numbers[]);
Lastly, a function needs to be created that will change the name of an employee inputted into the function with a new name
Here is the prototype of this function, please keep it exactly as it is below:
void change_employee_name(struct employee * e, char * new_employee_name);
Here are the employees that will be in the main function, these employee names are set and do NOT require the user to enter them and this function does NOT require any user input:
struct employee e1 = {1111111 , "James"};
struct employee e2 = {1212121 , "Jim"};
struct employee e3 = {3131313 , "Alice"};
struct employee e4 = {44444444 , "John"};
struct employee e5 = {33333333 , "John"};
struct employee e6 = {33333334 , "Jack"};
Thank you in advance! And I will upvote for the correct answer!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
