Question
Playing With Arrays The following problems are to give you practice with programming with arrays. Write a program to: 1.Ask the user for numbers and
Playing With Arrays
The following problems are to give you practice with programming with arrays. Write a program to:
1.Ask the user for numbers and place them in an array sequencially.
2.Next, print out the values in the array in the order they are stored.
3.Search the array for the postion containing the smallest value.
4.Print out the position where the smallest value was found.
5.Swap the smallest value with the value in the first postition of the array.
6.Print out the array in the order they are now stored.
7.Reverse the elements of the array.
8.Print out the array in the order they are now stored.
9.Add 1 to every odd number in the array.
10.Print out the array in the order they are now stored.
11.Repeatedly ask the user for a number and printout the position in the array where that number is stored. Print "Not Found" if the number is not in the array. Quit when the user enters a sentinel value (such as -1).
Directions
You must write a method to print out the elements of the array in the order they are stored. Use that method every time the array is printed.
Test your program thoroughly. Include a screen-grab printout of your tests and the results.
Hints:
Build up the program incrementally. Just do step 1 above and test it. Once working, add in step 2. Then test it. Then step 3, and so on.
Thanks for the help
Step 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