Answered step by step
Verified Expert Solution
Question
1 Approved Answer
All to be done in C++ no user input is required. Just need to create vectors and create functions to manipulate them as described. Search
All to be done in C++ no user input is required. Just need to create vectors and create functions to manipulate them as described.
Search 2D Vector - Part 2 Write a C++ program that uses a function to search a 2D vector of floats. The function will have 2 parameters: 1. A 2 dimensional vector of floats, v 2. The floating point number that you are searching for, item Rewrite the Search_2D_Vector function so that it can work with any data type. Show that this function can work with a 2D vector of type float and a 2D vector of type char. The function will return a vector of objects. Each object will contain the row and column of each instance where the item is found in the 2D vector If the vector does not contain the item that it is searched for, the vector returned will only have 1 object. Within this object, the value -1 will be stored in the row member. Output to the console screen a message indicating that the vector did not contain this item if this is the case. The main function will: Instructions: Write a function called Erase Vector Items. This function will take as input, 2 parameters: 1. A vector of integers 2. The integer to erase from the vector (if it exists) The post-condition after this function is called is that no element within the vector will contain this item. 1) Output the contents of the 2D vector 2) Output the item number that you are searching for 3) Call the function that will search the 2D vector 4) Output the locations of where the item can be found within the 2D vector or output a message indicating that the item is not located within the 2D vector Sample Run #1 2D vector contents -> 0 1 2 -2 0 2 Write a separate function that will output the contents of the vector. Demonstrate both functions working. Instructions: ********** Write a function called Erase_Vector_Items. This function will take as input, 2 parameters: The item that you searched for is: 0 The item that you searched for can be found at the following location(s) -> 1 1 Press any key to continue... Sample Run #2 1. A vector 2. The item to erase from the vector (if it exists) The post-condition after this function is called is that no element within the vector will contain this item. 2D_vector contents -> / / 4 4 4 4 4 4 ********** Erase_Vector_Items needs to work with vectors of any data-type. Write a separate function that will output the contents of the vector (of any data-type). The item that you searched for is: 0 This vector did not contain the item that you searched for. Press any key to continue.. Demonstrate both functions working with 2 different data-typesStep 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