Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- void sortuj(double tab[], int n)
- {
- for (int i = 0; i < n; i++)
- for (int j = 1; j < n - i; j++)
- if (tab[j - 1] > tab[j])
- swap(tab[j - 1], tab[j]);
- else continue;
- }
- int main()
- {
- double *tab;
- int n;
- cout << "Wprowadz liczbe elementow: ";
- cin >> n;
- tab = new double[n];
- cout << "Wprowadz liczby" << endl;
- for (int i = 0; i < n; i++)
- {
- cin >> tab[i];
- }
- sortuj(tab, n);
- for (int i = 0; i < n; i++)
- {
- cout << tab[i] << " " ;
- }
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement