Question: Tasks (in order): 1. Generate an array with 10 random numbers (random numbers must be between the values of 1 and 100, inclusive) 2. Print
Tasks (in order):
1. Generate an array with 10 random numbers (random numbers must be between the values of 1 and 100, inclusive)
2. Print the entire array (so that the user can check the programs output)
3. Sort the array
4. Print the entire array again
5. Allow the user to repeatedly search the array for numbers they specify
Notes:
Recall that in order to generate random numbers, you need to do three things:
1. Include the cstdlib and ctime libraries.
2. Seed the random number generator using srand(time(0));.
3. Get a random number using rand() % maxvalue + 1;.
#include#include #include using namespace std; int searchArray(const int arr[], int arr_size, int query); void populateArray(int arr[], int s); void printArray(const int arr[], int s); void sortArray(int arr[], int s); void swapVals(int& a, int& b); int main() { return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
