Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. class a{
  7. int t[6];
  8. int ilosc;
  9. public:
  10. void losuj()
  11. {
  12. srand(time( NULL ));
  13. int a[ 6 ];
  14. int x;
  15.  
  16. for( int i = 0; i < 6; i++ )
  17. {
  18. do
  19. {
  20. x =( rand() % 49 ) + 1;
  21. }
  22. while(( a[ 0 ] == x ) ||( a[ 1 ] == x ) ||( a[ 2 ] == x ) ||( a[ 3 ] == x ) ||( a[ 4 ] == x ) ||( a[ 5 ] == x ) );
  23.  
  24. a[ i ] = x;
  25.  
  26. cout << a[ i ] << "\n";
  27. }
  28. }
  29. };
  30.  
  31.  
  32.  
  33. int main(int argc, char** argv){
  34. cout << "Wylosowano:\n\n";
  35.  
  36. a p;
  37. p. losuj();
  38.  
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement