Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions