------ Build started: Project: 3.7.6, Configuration: Debug Win32 ------
Compiling...
main.cpp
c:\documents and settings\chris moore\my documents\visual studio 2005\projects\3.7.6\3.7.6\main.cpp(36) : warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
c:\documents and settings\chris moore\my documents\visual studio 2005\projects\3.7.6\3.7.6\main.cpp(44) : warning C4806: '==' : unsafe operation: no value of type 'bool' promoted to type 'int' can equal the given constant
c:\documents and settings\chris moore\my documents\visual studio 2005\projects\3.7.6\3.7.6\main.cpp(50) : warning C4806: '!=' : unsafe operation: no value of type 'bool' promoted to type 'int' can equal the given constant
Build log was saved at "file://c:\Documents and Settings\Chris Moore\My Documents\Visual Studio 2005\Projects\3.7.6\3.7.6\Debug\BuildLog.htm"
3.7.6 - 0 error(s), 3 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int choice = 1;
int chips = 1000;
while(choice == 1 && chips != 0)
{
cout << "Players's chips: $" << chips << endl;
cout << "1) Play slot 2) Exit: ";
cin >> choice;
if( choice == 2 )
{
choice = 2;
cout << "Exiting..." << endl;
}
else if( choice != 1 && choice != 2)
{
cout << "You did not make a valid selection!" << endl;
return 0;
}
else
{
int bet = 0;
cout << "Enter your bet: ";
cin >> bet;
cout << endl;
if(bet > 0 && bet <= chips)
{
srand ( time(0) );
int r0 = 2 + rand() % 6;
int r1 = 2 + rand() % 6;
int r2 = 2 + rand() % 6;
cout << r0 << " " << r1 << " " << r2 << endl;
if( r0 == r1 == r2 == 7 )
{
cout << "You win!" << endl;
chips = (chips - bet) + (10 * bet);
cout << "Player's chips: $" << chips << endl << endl;
}
else if( (r0 == r1 == r2 != 7) )
{
cout << "You win!" << endl;
chips = (chips - bet) + (7 * bet);
cout << "Player's chips: $" << chips << endl << endl;
}
else if( (r0 == r1 && r0 != r2 && r1 != r2) || (r0 == r2 && r0 != r1 && r2 != r1) || (r1 == r2 && r1 != r0 && r2 != r0) )
{
cout << "You win!" << endl;
chips = (chips - bet) + (3 * bet);
cout << "Player's chips: $" << chips << endl << endl;
}
else
{
cout << "You lose!" << endl;
chips -= bet;
cout << "Player's chips: $" << chips << endl << endl;
}
}
else
{
cout << "You did bot enter a valid bet";
}
if( chips == 0 )
{
chips = 0;
cout << "You've lost all your chips!" << endl << "Exiting..." << endl << endl;
}
}
}
}