Advertisement
Guest User

Cygus

a guest
Oct 19th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <time.h>
  4. #include <stdlib.h>
  5. using namespace std;
  6. int los (int a)
  7. {
  8. int x;
  9. srand(time(0));
  10. a =1 + rand() % 11;
  11. int i=1;
  12. while (i<6)
  13. {
  14. a = (rand() % 11);
  15. if (a>=x)
  16. {
  17. cout<<a<<" ";
  18. x=a;
  19. i++;
  20. }
  21. }
  22. return a;
  23. }
  24. main()
  25. {
  26. cout<<"Ciag niemalejacy 6 losowych liczb 1-10"<<endl;
  27. int x;
  28. cout<<los(x);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement