Advertisement
pan7nikt

kostka

Dec 10th, 2019
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <time.h>
  4. using namespace std;
  5.  
  6. int lpol = 1;
  7. int pos;
  8. int rnd;
  9. int Nrzutu = 0;
  10.  
  11. bool meta;
  12.  
  13. main()
  14. {
  15.     srand(time(NULL));
  16.     while(meta==false)
  17.     {
  18.         //rand()%(b-a+1)+a
  19.         Nrzutu++;
  20.         rnd = rand()%4 + 6;
  21.         cout << "wylosowano: " << rnd << endl;
  22.         lpol = lpol + rnd;
  23.         cout << "w rzucie: " << Nrzutu << endl;
  24.         cout << "jest na polu: " << lpol << endl;
  25.         if (lpol >= 100)
  26.         {
  27.             cout << "ukonczono po " << Nrzutu << " rzutach" << endl;
  28.             meta = true;
  29.         }
  30.        
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement