Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, please help me with this question. Code in C++. thanks 9.1 Lotto We will program a simulated lottery game using functions, loops, arrays, and

Hi, please help me with this question. Code in C++. thanksimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

9.1 Lotto We will program a simulated lottery game using functions, loops, arrays, and modular programming. Element Repeated Function bool elementRepeated(int a[], int element, int end) Write a function that that takes as parameters an array of ints, an int value named element, and an int value named end. Return a bool based on whether the element appears in the array starting from index 0 and up to but not including the end index. Generate a Random Array with no Repeats void randFill(int a, int len) Write a function that takes as parameters an array of integers and another integer for the size of the array. Create a loop that assigns a random value in the range [1..25] to each element of the array. When assigning an element, loop and regenerate the random number if the Element Repeated function determines that number already exists in the array. Input Array void userFill(int a, int len) Write a function that takes as parameters an array of integers and another integer for the size of the array. Create a loop that asks the user to input a number between 1 and 25 for each element of the array. Use an input validation while loop to ensure these numbers are within range, the input did not fail (cin.fail()), and that the element is not repeated. Clear out the read buffer if the input failed. Assign each input to an element of the array. Your validation loop condition to should look like this: while(a[i] 25 || cin.fail() || elementRepeated(a, a[i], i)) { cin.clear(); cin.ignore (512, ' '); cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

Compare the current team to the ideal team.

Answered: 1 week ago

Question

a. Do team members trust each other?

Answered: 1 week ago

Question

How do members envision the ideal team?

Answered: 1 week ago