Question
C++ Program 2 ( 12 Points ) Create and initialize a string array, write and use 3 functions. Write a program. Create a string array
C++
Program 2 ( 12 Points ) Create and initialize a string array, write and use 3 functions. Write a program. Create a string array in the main(), called firstNameArray, initialize with 7 first names Jim, Tuyet, Ann, Roberto, Crystal, Valla, Mathilda Write a first function, named searchArray, that passes two arguments: a single persons name and the array reference, into a function, This function should then search the array to see if the name is in the firstNameArray. If found, it will return the array index where the name is found, else it return the number 7. (This function needs 3 parameters see code examples above) Write the code in the main program to call/use the searchArray function. Check the return value for the index value returned. Print the name using the index number(0 to 6), or prints name not found if it return a 7. Write a second function, printAllNames, that will print all the names in the array. Pass the array into the function. (This function needs two parameters see code example above) Write the code in the main program to call/use this printAllNames function. Write a third function, called deleteName, that will delete a name from the array. Check first to see if the name is in the array, before you try to delete it (use the searchArray function). If you find the name, then write to the location in the array. Just making spot blank. (This function requires 3 parameters see code examples above). Call the printAllNames function to print the array to verify you have deleted a value. Print out the array if the spot/index in the array is blank do not print it. Use filename: Week15YourNameFunProg2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started