🟢 Վարժություն 13
Գրել ֆունկցիա, որը որպես արգումենտ ստանում է
int
տիպի զանգված և վերադարձնում է true
, եթե զանգվածը դասավորված է աճման կարգով, հակառակ դեպքում`false
։ #include <iostream>
bool isSorted(int arr[], const int size) {
// Put your code here
}
int main() {
const int N = 10;
int arr[N] = {};
std::cout << "Input " << N << " size array: ";
for (int i = 0; i < N; i++) {
int in;
std::cin >> in;
arr[i] = in;
std::cout << arr[i] << " ";
}
std::cout << std::endl;
// Call isSorted here
}
Constraints
Time limit: 1 seconds
Memory limit: 512 MB
Output limit: 1 MB