Write a program that initially generats and displays an array of 3 random intege
ID: 3635769 • Letter: W
Question
Write a program that initially generats and displays an array of 3 random integer numbers ranging from 0 to 4. After the displaying of the array, it displays the following:R(everse) J(ackpot) E(xit)
Please select an option:
Then if the user selects:
R(lowercase or uppercase): the main() function calls a user defined function in reverse(int array{}) that takes the random array as a parameter and displays it in rreversed order, from the last element to the first. Then, the function adds the three elements of the array and returns the result to the main() function. Eventually, back to the main() function, the program displays a message reporting the resulting sum.
J: the main() function calls a userdefined function bool jackpot (int array{}) that takes the random array as an input parameter and checks if the three numbers in the array are equal.if they are the function returns true, otherwise it returns false. Eventually, back to the main() function, the program saves the text message “JACKPOT!!!” or “Sorry, try again…”, according to the value returned by the function, into a text file with name and location of your choosing
E: the program exits.
Explanation / Answer
Hi, #include #include using namespace std; int reverse(int array[]) { int sum=0; for(int i=2;i>=0;i--) { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.