Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- const int N = 5;
- int main()
- {
- setlocale(LC_ALL, "Rus");
- int a[N];
- cout << "Введите элементы массива " << endl;
- for (int t = 0; t < N; t++)
- {
- cin >> a[t];
- }
- for (int i = 0; i < N - 1; i++)
- {
- for (int j = i + 1; j < N; j++)
- {
- if (a[i] > a[j])
- {
- swap(a[i], a[j]);
- }
- }
- }
- cout << " Результат сортировки равен: ";
- for (int t = 0; t < N; t++)
- cout << a[t] << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment