works as intended to work.. well sorta
works as intended tho however, I was hoping to have \n for cin.get(); can be used over and over instead of adding cin>>var; cin.ignore(); .. still works thx for the help everyone.
Code:
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
randomize();
int money, bet, a;
char pass='ok', ans;
cout<<"\t\t\tBETTING GAME\n\n\n";
cout<<"RULES:\n\n";
cout<<"1. Enter your starting money when prompted.\n";
cout<<"2. Type in your bet when prompted.\n";
cout<<"3. Roll Higher then 65 and you win DOUBLE your bet.\n";
cout<<"4. Roll a 1 or a 100 and win TRIPPLE your bet.\n";
cout<<"5. If you want to chashout, enter in '9999' when the next\n";
cout<<"betting time comes.\n";
cout<<"6. After you cashout you will see if you won money or lost money.\n\n\n";
cout<<"Press any key to continue once you've understood these rules.";
cin.get();
do{
clrscr();
cout<<"How much money would you like to start with?: ";
cin>>money;
a=money;
clrscr();
cout<<" ____________________\n"
<<"| MONEY |\n"
<<"|--------------------|\n"
<<" "<<money<<" \n"
<<"|____________________|\n"
<<flush;
for(int die=random(100)+1;3==3;die=random(100)+1) {
if(money<=0) {
cout<<"You are out of money. ";
break;}
cout<<"How much do you want to bet?(9999 to quit): ";
cin>>bet;
if((bet>money)&&(bet!=9999)) {
cout<<"You cannot bet over the amount of money you have!\n";
cout<<"Enter 'ok' to continue:...";
cin>>pass;
cin.ignore();
clrscr();
cout<<" ____________________\n"
<<"| MONEY |\n"
<<"|--------------------|\n"
<<" "<<money<<" \n"
<<"|____________________|\n"
<<flush;
continue;
}
if(bet==9999){
break;}
money=money-bet;
cout<<"You rolled a "<<die;
if(die>65) {
money=money+bet+bet;
cout<<" and won DOUBLE your bet.\n";
}
else if((die==1)||(die==100)) {
money=money+bet+bet+bet;
cout<<" and won TRIPPLE your bet.\n";
}
else if((die>1)&&(die<66)) {
cout<<" Sorry, better luck next time.\n";
}
cout<<"Enter in 'ok' to continue:...";
cin>>pass;
cin.ignore();
clrscr();
cout<<" ____________________\n"
<<"| MONEY |\n"
<<"|--------------------|\n"
<<" "<<money<<" \n"
<<"|____________________|\n"
<<flush;
}
if(money>a) {
cout<<"You won a profit of "<<(money-a)<<".";}
if(money<a) {
cout<<"You lost "<<(a-money)<<".\n";}
cout<<"Do you want to play again?(Y/N): ";
cin>>ans;
}while(ans=='y'||ans=='Y');
return(0);
}