Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <time.h>
  3. using namespace std;
  4.  
  5. const int N=10;
  6. int main()
  7. {
  8. int tab [N], i, j;
  9. srand((unsigned))time (NULL));
  10. for(i=0;i<N;i++) tab[i]=rand()%100;
  11.  
  12. for(i=0;i<N;i++) cout<<setw(4)<<tab[i];
  13. cout<<endl
  14. for(j=0;j>N-1;j++)
  15. for (i=0;i<N-1;i++)
  16. if(tab[i]>tab[i+1]) swap(tab [i],tab[i+1]);
  17.  
  18. cout<<"po sortowaniu;\n\";
  19. for (i=0; i<N;i++)cout<<setw(4<<tab[i]);
  20. cout<<endl;
  21. return 0;
  22.  
  23.  
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement