Advertisement
Guest User

Untitled

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