#include#include int main() { std::array arr = {1, 2, 3, 4, 5}; std::cout << "Size of arr: " << arr.size() << std::endl; std::cout << "Element at index 3: " << arr[3] << std::endl; arr.fill(0); std::cout << "After filling with 0's: " << std::endl; for (int i = 0; i < 5; ++i) { std::cout << arr[i] << std::endl; } return 0; }
#includeThis code creates an array of 6 integers and initializes it with values. It then sorts the array using the std::sort() algorithm from the#include #include int main() { std::array arr = {4, 1, 7, 2, 8, 3}; std::sort(arr.begin(), arr.end()); std::cout << "Sorted array: " << std::endl; for (int i = 0; i < 6; ++i) { std::cout << arr[i] << std::endl; } return 0; }