Question: In c++, write a program that uses a function called feelinglucky that takes an integer as an argument. In the function, generate a number between
In c++, write a program that uses a function called feelinglucky that takes an integer as an argument. In the function, generate a number between 1 and 12. If the number is 7, the integer passed to the function will change to the number 7, otherwise the integer keeps its value. In your program, declare an integer named lucky and initialize it to the number zero. Attempt to get the lucky Number 7 10 times. After 10 tries, if lucky is 7, print to the console, "it took, [number] of tries to get lucky." If lucky is not 7, after 10 tries, print to the console, the words "Your number is [value of integer], better luck next time" (Note: [value of integer] represents the value of lucky). This program should use top-down design and have at least two functions.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
