Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <cstdlib>
  4. using namespace std;
  5. int main()
  6. {
  7. int arr[6],losowa;
  8. srand(time(NULL));
  9. for(int i=0;i<6;i++)
  10. {
  11. do{
  12. losowa=rand()%36+1;
  13. }while
  14. (
  15. losowa==arr[0]
  16. ||
  17. losowa==arr[1]
  18. ||
  19. losowa==arr[2]
  20. ||
  21. losowa==arr[3]
  22. ||
  23. losowa==arr[4]
  24. ||
  25. losowa==arr[5]
  26. );
  27. arr[i]=losowa;
  28.  
  29. }
  30. for(int i=0;i<6;i++)
  31. {
  32. cout << arr[i] << endl;
  33. }
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement