Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

#include <iostream>

#include <time.h>
#include <ctype.h>
using namespace std;

char *colour[3] = { "r", "n","y"};


int credit = 1000, val,gamb;
char rn, ver,ret;
int main ()
{
srand (time (NULL));

while(credit!=0){

cout<<"Credit: "<<credit<<endl;
cout<<"Enter gambilng money(NUMBER ONLY): ";
cin>>gamb;
if(gamb<=0){
cout<<endl;
cout<<"Gamble money must be higher than 0!";
cout<<endl;
cout<<"Enter gambilng money: ";
cin>>gamb;
}
if(gamb<=credit){
credit=credit-gamb;
}
else while(gamb>credit){
cout<<endl;
cout<<"Gamble money must be lower than your credit!";
cout<<endl;
cout<<"Enter gambilng money: ";
cin>>gamb;
}
cout << "Cash out? Press:y" << endl;
while (gamb != 0 && gamb <= 1000000)
{
val = rand () % 2;
cout << "Gambled money: " << gamb << endl;
cout << "r/n or cash out?";
cout << endl;
cin >> rn;
ver = *colour[val];
if (rn == ver && rn != *colour[2])
{
gamb = gamb * 2;
}
else if(rn != ver){
gamb=0;
}

else if (rn == *colour[2])


{
cout << "Cashed out at " << gamb<<endl;
credit=credit+gamb;
gamb=0;
}
}
}
if(credit==0){
cout<<"walking L+broke";
}
return 0;
}

You might also like