Regeneric

Untitled

Jan 25th, 2021
484
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <random>
  3. #include <chrono>
  4.  
  5. int main() {
  6.     unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
  7.     static std::default_random_engine generator(seed);
  8.     std::uniform_int_distribution<int> dist(1, 100);
  9.  
  10.     int numCnt = 0;
  11.     int min = 0, max = 0;
  12.  
  13.     for(int i = 0; i != 10; ++i) {
  14.         int bufNum = dist(generator);
  15.        
  16.         if(numCnt <= 0) {min = bufNum; max = bufNum;}
  17.  
  18.         if(!(bufNum%2)) continue;
  19.         else {
  20.             numCnt++;
  21.             std::cout << "Wylosowano " << bufNum << std::endl;
  22.         }
  23.    
  24.         if(bufNum < min) min = bufNum;
  25.         if(bufNum > max) max = bufNum;
  26.    
  27.         if(!(bufNum % 7)) break;
  28.     }
  29.    
  30.     std::cout << "MIN: " << min << std::endl;
  31.     std::cout << "MAX: " << max << std::endl;
  32.    
  33.     return 0;
  34. }
RAW Paste Data