Game of Craps C++ #include using namespace std; void roll (int *); // using pointer to catch the random variable value of two dicerolls at
Game of Craps C++
#include
using namespace std; void roll (int *); // using pointer to catch the random variable value of two dicerolls at one time .
//these global variable with static variable win use to operate the working of code . //static win, account because two times input given by user to add the diceroll with win number and //account (means balance of user) .
static int account = 100; static int win = 0; int bet = 0;
int main () { char c; int diceroll1, diceroll2; cout << "Welcome to the CRAPS game. "; while(1){ cout << "You have $"<
void roll (int *a) { win = win + *a; }
Modify the craps program to keep track of your bank. After each hand, you have Do you want to roll again (y/n/s). If you select s you can save your amount of money. The game then repeats the question so you can continue or press n to quit. When you first start the program it asks, Do you want to load a previous session? If you say y, your bank is updated to the amount it was when it was saved. If you say n, the game proceeds as before. If there was no previous session, obviously the program wont be able to find your save file, and should give an appropriate message like, Sorry, no save file exists on this computer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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