Question: 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

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:

- ask the user to search for a query number

- 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

- if the query number is not in the list: exit the loop

Example execution:

$ ./a.out

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: -10

-10 was at location 2

Current list: 4 0 0 22 -33 55

Enter a query number: 53

53 not in list!

Goodbye!

$

*********

notes: i was able to get the swap and everything here is my code below, but i cannot get it to work when a number is not there in the listWrite a program that follows the steps below: 1. input 6 numbers

1 //Katie Mays 2 //Dec. 7, 2017 3 //LAB9: number search and query 4 5 #include 6 using namespace std; 7 8 // prototypes 9 void swap (int , int) 10 11 int main() 12 13 14 15 16 17 18 19 20 21 /I variables int integers [6]={0}, query; // input for (int i =0; i > integers[i]; 23 24 25 26 27 28 29 // processing and output for (int i 0; i > query swap(integers, query); 31 32 cout

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!