Ill explain first what the problem is and then show code:
I recently discovered this site and read up on the cin.get(); so that text can be displayed before the program closes. I used it for when certain text is displayed, the user can press any key and then the program will process clrscr();. As you can see in my code, I used cin.get() two times. Once after rules are displayed and twice to clear die results. the cin.get() works for the first time I use it but it seems to skip the second cin.get().
My program randomizes die results 1 to 100 and if you roll over a number you win your bet back+bet (DOUBLE).
Also having problems with the else if's... when win double your bet, you only get your bet back and not the extra +bet. Cashout block not added yet til I know what the solution is to my current problem.Code:#include<iostream.h> #include<stdlib.h> #include<conio.h> int main() { randomize(); int money, bet; 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(); clrscr(); cout<<"How much money would you like to start with?: "; cin>>money; clrscr(); cout<<" ____________________\n"; cout<<"| MONEY |\n"; cout<<"|--------------------|\n"; cout<<" "<<money<<" \n"; cout<<"|____________________|\n"; for(int die=random(100)+1;3==3;die=random(100)+1) { cout<<"How much do you want to bet?(9999 to quit): "; cin>>bet; 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<<"Press any key to continue..."; cin.get(); clrscr(); cout<<" ____________________\n"; cout<<"| MONEY |\n"; cout<<"|--------------------|\n"; cout<<" "<<money<<" \n"; cout<<"|____________________|\n"; } return(0); }