Question: Create a program that creates an array of size n, where n is a const int (I will modify your code by changing the value

 Create a program that creates an array of size n, where

Create a program that creates an array of size n, where n is a const int (I will modify your code by changing the value of n, and your code should still behave properly). The code shall then initialize the array with a random value for each element, drawn using the c standard library function rand (), and hence the function rand () shall be called n times. Your code shall then ask the user to choose either to reverse the array, re-initialize the array, or exit one in lab 2. If the user enters 'i or T', your If the user enters '' or 'R', your program shall swap array values as d code shall initialize the array code shall exit. with another set of random values. If the user enters any other character, then your Hints: To generate a random number you shall include the header file stdlib.h (#include ) and . use the function rand ) (e.g. myvar-rand ();) . Code your algorithm in C++ . Test your code before you submit it . Debug your code; If it did not work properly, ask why (from a high level) did it not work? Is it an algorithmic or coding error? Use the debugger to identify the root-cause and fix your code What to hand in: . A description of your algorithm in pseudocode, flow chart, or plain English. The actual code in a " cpp" file (with comments) . A screen dump of your screen showing the initial output of your program, an output when the user enters r, and an output when the user enters 'i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!