Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<ctime>
- using namespace std;
- void main(){
- unsigned int points = 100;
- unsigned int bet = 0;
- int uNum = 0;
- int cNum = 0;
- int dice1 = 0;
- int dice2 = 0;
- while(points>=0){
- cout<<"Now you have "<<points<<" points"<<endl<<endl;
- cout<<"Place your bet : ";
- cin>>bet;
- if(bet>points||bet<0){
- cout<<"Bet wrong or greater then your points"<<endl;
- continue;
- }
- cout<<"Put your number :";
- cin>>uNum;
- if(uNum>12||uNum<2){
- cout<<"Number must be greater the 2 and lesser then 12"<<endl;
- continue;
- }
- cout<<""<<endl;
- cout<<"Now the computer throwing dices ..."<<endl;
- srand(time(NULL));
- dice1 = rand()%6+1;
- cout<<"The first dice is "<<dice1<<endl;
- dice2 = rand()%6+1;
- cout<<"The second dice is "<<dice2<<endl;
- cNum = dice1+dice2;
- if(cNum<7&&uNum<7){
- points+=bet;
- cout<<"You win "<<bet<<" points"<<endl;
- continue;
- }
- if(cNum>7&&uNum>7){
- points+=bet;
- cout<<"You win "<<bet<<" points"<<endl;
- continue;
- }
- if(cNum==uNum){
- points=points+(bet*4);
- cout<<"You win "<<bet<<" points"<<endl;
- continue;
- }
- cout<<"You loose your bet!"<<endl;
- cout<<"You loose "<<bet<<" points"<<endl;
- points=points-bet;
- cout<<endl<<endl;
- continue;
- }
- }
Add Comment
Please, Sign In to add comment