practice: random number sorting
Write a program that:
- Creates an integer array of size 10.
- Fills the array with random numbers between 1 and 100.
- Prints the array contents to the console.
- Sorts the array with any sorting algorithm of your choice.
- Prints the array contents again.
- Asks the user to pick a number to search for.
- Searches the array for the given number.
- Prints the location of the number or that it was not found.
Example input and output:
Unsorted array:
84 68 55 93 21 23 48 82 53 6
Sorted array:
6 21 23 48 53 55 68 82 84 93
What value are you looking for? 23
The value is in element 2
Press any key to continue . . .