Guest User

Untitled

a guest
Jul 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. #include<iostream>
  2. #include<ctime>
  3.  
  4. using namespace std;
  5.  
  6. void main(){
  7.  
  8.     unsigned int points = 100;
  9.     unsigned int bet = 0;
  10.     int uNum = 0;
  11.     int cNum = 0;
  12.  
  13.     int dice1 = 0;
  14.     int dice2 = 0;
  15.  
  16.     while(points>=0){
  17.  
  18.        
  19.         cout<<"Now you have "<<points<<" points"<<endl<<endl;
  20.  
  21.         cout<<"Place your bet : ";
  22.         cin>>bet;
  23.        
  24.         if(bet>points||bet<0){
  25.  
  26.             cout<<"Bet wrong or greater then your points"<<endl;
  27.             continue;
  28.         }
  29.  
  30.         cout<<"Put your number :";
  31.         cin>>uNum;
  32.  
  33.         if(uNum>12||uNum<2){
  34.  
  35.             cout<<"Number must be greater the 2 and lesser then 12"<<endl;
  36.             continue;
  37.         }
  38.  
  39.         cout<<""<<endl;
  40.         cout<<"Now the computer throwing dices ..."<<endl;
  41.         srand(time(NULL));
  42.         dice1 = rand()%6+1;
  43.         cout<<"The first dice is "<<dice1<<endl;
  44.         dice2 = rand()%6+1;
  45.         cout<<"The second dice is "<<dice2<<endl;
  46.         cNum = dice1+dice2;
  47.  
  48.             if(cNum<7&&uNum<7){
  49.  
  50.                 points+=bet;
  51.                 cout<<"You win "<<bet<<" points"<<endl;
  52.                 continue;
  53.             }
  54.  
  55.             if(cNum>7&&uNum>7){
  56.  
  57.                 points+=bet;
  58.                 cout<<"You win "<<bet<<" points"<<endl;
  59.                 continue;
  60.             }
  61.  
  62.             if(cNum==uNum){
  63.  
  64.                 points=points+(bet*4);
  65.                 cout<<"You win "<<bet<<" points"<<endl;
  66.                 continue;
  67.             }
  68.  
  69.  
  70.     cout<<"You loose your bet!"<<endl;
  71.     cout<<"You loose "<<bet<<" points"<<endl;
  72.     points=points-bet;
  73.     cout<<endl<<endl;
  74.     continue;
  75.  
  76.  
  77.  
  78.  
  79.  
  80.     }
  81.  
  82.  
  83. }
Add Comment
Please, Sign In to add comment