Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- using namespace std;
- int main()
- {
- int i, j, pom;
- int tab [10];
- cout << "Podaj elementy tablicy do sortowania" << endl;
- for (i = 1; i <= 10; i++)
- {
- cout << "Element nr " << i << " = ";
- cin >> tab [i];
- }
- for (j = 10; j > 1; j--)
- for (i = 1; i<= j; i++)
- if (tab [i] > tab [i+1])
- {
- pom = tab [i];
- tab [i] = tab [i+1];
- tab [i+1] = pom;
- }
- cout << endl << "Oto zawartosc tablicy po posortowaniu:" <<endl;
- for (i=1; i<=10; i++) cout << tab [i] << " ";
- cout << endl;
- system ("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement