Hi, everyone! I have to do a program for my compsci class involving arrays. Basically what happens is the user creates an array by inputting six numbers. Then the user inputs a query. If the query is one of the numbers in the array, the program will replace that number with a 0. An example output would be this:
Input number 1: 5
Input number 2: 62
Input number 3: 582
Input number 4: -2
Input number 5: 8
Input number 6: 24
Enter query number: 62
62 was in location 2.
The new array is: 5 0 582 -2 8 24
And that would continue on. The problem with my code is that it only continues the loop if the query is larger than the query before it. If I were to put 582 afterwards then it would work, but if I were to put -2 it wouldn't.
Also, when the array is output it doesn't print the numbers in a line. It makes a new line for each one. How can I fix this?
(I know the code isn't perfect or even probably good, but as long as it works I don't care.)