Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int tab[] = {3, 2, 5, 6, 1, 12, 15, 675, 23, 9}; // 10
- const size_t SIZE = 10;
- cout << "Lista przed posortowaniem:" << endl;
- for (int i: tab)
- cout << i << " ";
- cout << endl;
- for (int i = 0; i < SIZE; ++i)
- {
- for (int j = 0; j < SIZE-i-1; ++j)
- {
- if(tab[j] > tab[j+1])
- {
- int temp = tab[j+1];
- tab[j+1] = tab[j];
- tab[j] = temp;
- }
- }
- }
- cout << "Lista po posortowaniu: " << endl;
- for (int i: tab)
- cout << i << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement