Answered step by step
Verified Expert Solution
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++. thanks
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, ' '); coutStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started