Question: Can someone please help me with this C++ problem: write a program that follows the steps below: 1. Input 6 numbers from the user user

Can someone please help me with this C++ problem:

write a program that follows the steps below: 1. Input 6 numbers from the user user inputs numbers one at a time

2. Loop continuously until the exit condition below:

a) ask the user to search for a query number

b) if the query number is in the list: reports the first location of the query number in the list, change the number in that position to 0, show the updated list

c) if the query number is not in the list: exit the loop You must write at least one new function: findAndReplace(array1,...,query) take in an array and query number as input (in addition to any other needed inputs); it will return the first location of the query number in the list (or -1 if it is not in the list) and will change the number at that location to 0. You may receive the number inputs and print all outputs in int main if you wish. You may report location based on 0-indexing or 1-indexing (but you need 0-indexing to access the array elements!).

Example execution:

$ ./numberSearch

Input number 1 4

Input number 2 -10

Input number 3 8

Input number 4 22

Input number 5 -33

Input number 6 55

Enter a query number: 8

8 was at location 3

Current list: 4 -10 0 22 -33 55

Enter a query number: 4

4 was at location 1

Current list: 0 -10 0 22 -33 55

Enter a query number: -10

-10 was at location 2

Current list: 0 0 0 22 -33 55

Enter a query number: 53

53 not in list! Goodbye!

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!