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 list
1 //Katie Mays 2 //Dec. 7, 2017 3 //LAB9: number search and query 4 5 #includeStep 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