Posted: August 1st, 2023
Write the following two functions in C++1. void generate(int arr, int size)to generate a random permutation of the numbers 1 to 10.To generate a random permutation, the function needs to fill a permutation array with the numbers 1 to 10 so that NO two elements in the permutation array have the same contents. To achieve that, your function should do the following:• Create a second array (name this array source) and fill it with numbers from 1 to 10.
• Randomly select an element from the array source
• Remove the selected element from source and append it to the permutation array.2. void print_array(int arr, int size)to print out the elements in the permutation array separated by a white space.Write a C++ code that calls the generate and print_arrays functions repeatedly (5 times) to generate five random permutations of the numbers 1 to 10 and display the outcome at the console.
Place an order in 3 easy steps. Takes less than 5 mins.