Apparcane

C++. Відсортувати масив у зростаючому порядку

Dec 9th, 2024 (edited)
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | Source Code | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int arr[] = {5, 2, 8, 1, 3};
  7.     int size = sizeof(arr) / sizeof(arr[0]);
  8.  
  9.     sort(arr, arr + size);
  10.  
  11.     cout << "Відсортований масив: ";
  12.     for (int i = 0; i < size; i++) {
  13.         cout << arr[i] << " ";
  14.     }
  15.     cout << endl;
  16.     return 0;
  17. }
  18.  
Tags: C++
Advertisement
Add Comment
Please, Sign In to add comment