Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void checkmon(int array[], int m);
  5.  
  6. int main()
  7. {
  8. int arr[5] = { 1,2,3,4,5 };
  9. checkmon(arr, 4);
  10. return 0;
  11. }
  12. void checkmon(int array[], int m)
  13. {
  14. if (m < 1)
  15. {
  16. cout << "Is monotone" << endl;
  17. }
  18. else if (array[m] > array[m - 1])
  19. {
  20. checkmon(array, m-1);
  21. }
  22. else if (array[m] <= array[m - 1])
  23. {
  24.  
  25. cout << "Not monotone" << endl;
  26.  
  27. }
  28.  
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement