Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- const int SIZE = 5; // размер массива
- int a[SIZE];
- cout << "Введите " << SIZE << " чисел" << endl;
- for (int i=0; i<SIZE; i++)
- cin >> a[i];
- // упорядочить по возрастанию
- for (int i=0; i<SIZE-1; i++)
- for (int j=i+1; j<SIZE; j++)
- if (a[j] < a[i])
- {
- int tmp = a[j];
- a[j] = a[i];
- a[i] = tmp;
- }
- for (int i=0; i<SIZE; i++)
- cout << a[i] << " ";
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement