Advertisement
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;
- void boo(int *a, int N)
- {
- for (int i = 0; i < N - 1; i++)
- {
- int min = i;
- for (int max = i + 1; max < N; max++)
- {
- if (a[max] < a[min])
- {
- min = max;
- }
- }
- swap(a[i], a[min]);
- }
- cout << "Результат сортировки равен : ";
- }
- void vvedite(int *a ,int N )
- {
- cout << "Введите элементы массива " << endl;
- for (int t = 0; t < N; t++)
- {
- cin >> a[t];
- }
- }
- void rez(int* a ,int N)
- {
- for (int t = 0; t < N; t++)
- {
- cout << a[t] << " ";
- }
- }
- int main()
- {
- setlocale(LC_ALL, "Rus");
- int a[N];
- vvedite(a, N);
- boo(a,N);
- rez(a, N);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement