Q#2 Submit this question as one CPP files Write a complete C++ program. In this program you have to write 3 functions in addition to the main function. 1. Function #1: Write function throwDice that generates a random number between 1 and 6. The function should return the generated number. int throwDice(); 1. Function #2: Write function userGuess that asks the user to enter a valid number between 1 and 6. The function should ask the user to re-enter as long as the input is not valid. The function should return the valid input of the user. int userGuess(); 1. Function #3: Write function decide that receives as input parameters two integers, the first parameter dice represents the dice value and the second parameter userG represents a user guess. This function should return true if userG and dice are equal; otherwise, it should return false. bool decide(int dice, int userG); Write a complete program to do the following in the main: 1. Call the function dice. 2. Call the function userGuess. 3. Call the function decide passing to it the previous returned values of calling dice and userGuess. 4. Display "Win" if the returned value of calling the function decide is true, otherwise, display "lose". 5. Repeat all the above steps (step a to step d) until the user decides to stop and exit the program.
Q#2 Submit this question as one CPP files Write a complete C++ program. In this program you have to write 3 functions in addition to the main function. 1. Function #1: Write function throwDice that generates a random number between 1 and 6. The function should return the generated number. int throwDice(); 1. Function #2: Write function userGuess that asks the user to enter a valid number between 1 and 6. The function should ask the user to re-enter as long as the input is not valid. The function should return the valid input of the user. int userGuess(); 1. Function #3: Write function decide that receives as input parameters two integers, the first parameter dice represents the dice value and the second parameter userG represents a user guess. This function should return true if userG and dice are equal; otherwise, it should return false. bool decide(int dice, int userG); Write a complete program to do the following in the main: 1. Call the function dice. 2. Call the function userGuess. 3. Call the function decide passing to it the previous returned values of calling dice and userGuess. 4. Display "Win" if the returned value of calling the function decide is true, otherwise, display "lose". 5. Repeat all the above steps (step a to step d) until the user decides to stop and exit the program.
Chapter1: Financial Statements And Business Decisions
Section: Chapter Questions
Problem 1Q
Related questions
Question
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
Unlock instant AI solutions
Tap the button
to generate a solution
Recommended textbooks for you
Accounting
Accounting
ISBN:
9781337272094
Author:
WARREN, Carl S., Reeve, James M., Duchac, Jonathan E.
Publisher:
Cengage Learning,
Accounting Information Systems
Accounting
ISBN:
9781337619202
Author:
Hall, James A.
Publisher:
Cengage Learning,
Accounting
Accounting
ISBN:
9781337272094
Author:
WARREN, Carl S., Reeve, James M., Duchac, Jonathan E.
Publisher:
Cengage Learning,
Accounting Information Systems
Accounting
ISBN:
9781337619202
Author:
Hall, James A.
Publisher:
Cengage Learning,
Horngren's Cost Accounting: A Managerial Emphasis…
Accounting
ISBN:
9780134475585
Author:
Srikant M. Datar, Madhav V. Rajan
Publisher:
PEARSON
Intermediate Accounting
Accounting
ISBN:
9781259722660
Author:
J. David Spiceland, Mark W. Nelson, Wayne M Thomas
Publisher:
McGraw-Hill Education
Financial and Managerial Accounting
Accounting
ISBN:
9781259726705
Author:
John J Wild, Ken W. Shaw, Barbara Chiappetta Fundamental Accounting Principles
Publisher:
McGraw-Hill Education