slotts.cpp
// Programmer: Clayton Price date: 10/13/13
// File: slotts.cpp
// Purpose: This file contains the main function for the slotts simulation
// program for Moes bar.
#include <iostream>
#include "slotts.h"
using namespace std;
int main()
{
/* -------------------------- declarations -------------------- */
float game_bal=INIT_GAME_BAL; // user's money for game
float bank_bal=0; // user's money in the Bankk
char menu_choice;
bool cash_out = false;
bool first_time = true; // first time checking bal
bool bank_bal_checked = false;
bool funds_transferred = false;
/* -------------------------------------------------------------- */
welcome();
cout.setf(ios::fixed); // output formating
cout.setf(ios::showpoint);
cout.precision(2);
srand(time(NULL));
do
{
switch(present_menu())
{
case '1': case 'c':
if(first_time)
establish_bankBalance(first_time,bank_bal_checked,bank_bal);
show_balances(game_bal,bank_bal);
break;
case '2': case 't':
if(bank_bal_checked)
{
transfer(funds_transferred,bank_bal,game_bal);
show_balances(game_bal,bank_bal);
}
else
cout<<"\n\t\tERROR: You must check your balance first!"<<endl;
break;
case '3': case 'p':
if (funds_transferred)
play_game(game_bal);
else
cout<<"\n\n\t\tYOU MUST TRANSFER FUNDS TO THE GAME BEFORE PLAYING"
<<endl<<endl;
break;
case '4': case 'l': case 'x':
cash_out = true;
goodbyes();
break;
}
} while (!cash_out);
return 0;
}