Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <time.h>
- using namespace std;
- const int N=10;
- int main()
- {
- int tab [N], i, j;
- srand((unsigned))time (NULL));
- for(i=0;i<N;i++) tab[i]=rand()%100;
- for(i=0;i<N;i++) cout<<setw(4)<<tab[i];
- cout<<endl
- for(j=0;j>N-1;j++)
- for (i=0;i<N-1;i++)
- if(tab[i]>tab[i+1]) swap(tab [i],tab[i+1]);
- cout<<"po sortowaniu;\n\";
- for (i=0; i<N;i++)cout<<setw(4<<tab[i]);
- cout<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement