Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cstdlib>
- #include <ctime>
- 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\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