EBK C HOW TO PROGRAM
EBK C HOW TO PROGRAM
8th Edition
ISBN: 9780100663831
Author: Deitel
Publisher: YUZU
Question
Book Icon
Chapter 5, Problem 5.47E
Program Plan Intro

Program plan:

  • Define a global variable bankBalance initialized with value 1000.
  • Define function playCraps which takes an argument wager of type int and plays one round of craps game.Use code from book to define this function. In this function, makes changes to increase bankBalance by wager and decrease bankBalance by wager whenever player wins or loose.
  • Define the main function. Inside main
    • Define a variables wager, validWager and resp.
    • Use do while loop to perform following tasks:
    • Read wager from user.
    • Check if wager is less than equal to bank balance.
    • Call playCraps function.
    • Display messages based on player performance.
    • Take response from user whether to continue to next game or not.

Program description:

This program is the modified version of game of craps program given in figure 5.14 which allows wagering.

Blurred answer
Students have asked these similar questions
State whether the following are true or false. If the answer is false, explain why.b) The break statement is required in the default case of a switch selection statement.
Answer the following.  The correct one in function if the code.
What’s the output of the following programs?

Chapter 5 Solutions

EBK C HOW TO PROGRAM

Ch. 5 - Prob. 5.19ECh. 5 - (Displaying a Square of Any Character) Modify the...Ch. 5 - Prob. 5.21ECh. 5 - (Separating Digits) Write program segments that...Ch. 5 - (Time in Seconds) Write a function that takes the...Ch. 5 - (Temperature Conversions) Implement the following...Ch. 5 - (Find the Minimum) Write a function that returns...Ch. 5 - (Perfect Numbers) An integer number is said to be...Ch. 5 - Prob. 5.27ECh. 5 - (Reversing Digits) Write a function that takes an...Ch. 5 - (Greatest Common Divisor) The greatest common...Ch. 5 - (Quality Points for Students Grades) Write a...Ch. 5 - (Coin Tossing) Write a program that simulates coin...Ch. 5 - (Guess the Number) Write a C program that plays...Ch. 5 - (Guess the Number Modification) Modify the program...Ch. 5 - (Recursive Exponentiation) Write a recursive...Ch. 5 - (Fibonacci) The Fibonacci series 0, 1, 1, 2, 3, 5,...Ch. 5 - (Towers of Hanoi) Every budding computer scientist...Ch. 5 - Prob. 5.37ECh. 5 - Prob. 5.38ECh. 5 - Prob. 5.39ECh. 5 - Prob. 5.40ECh. 5 - (Distance Between Points) Write a function...Ch. 5 - Prob. 5.42ECh. 5 - Prob. 5.43ECh. 5 - After you determine what the program of Exercise...Ch. 5 - (Testing Math Library Functions) Write a program...Ch. 5 - Find the error in each of the following program...Ch. 5 - Prob. 5.47ECh. 5 - (Research Project: 1m proving the Recursive...Ch. 5 - (Global Warming Facts Quiz) The controversial...Ch. 5 - Prob. 5.50MDCh. 5 - Prob. 5.51MDCh. 5 - (Computer-Assisted Instruction: Monitoring Student...Ch. 5 - (Computer-Assisted Instruction: Difficulty Levels)...Ch. 5 - (Computer-Assisted Instruction: Varying the Types...
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning