fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void checkOrder(int arr[], int n) {
  6.  
  7. int i;
  8. i = 1;
  9. while(i < n && arr[i] == arr[0]) i++;
  10.  
  11.  
  12. if(i == n) cout<<"Sir Constant.";
  13. else if(i < n) {
  14.  
  15. if(arr[i] > arr[i-1]) {
  16.  
  17. int order = 1;
  18.  
  19. for(int j = i; j < n; j++) {
  20. if(arr[j]<arr[j-1]) {
  21. order = 0;
  22. }
  23. }
  24.  
  25. if(order == 1) cout<<"Sir Ordonat Strict Crescator.";
  26. else
  27. cout<<"Sir Unordered.";
  28.  
  29. } else if(arr[i] < arr[i-1]) {
  30.  
  31. int order = 1;
  32.  
  33. for(int j = i; j < n; j++) {
  34. if(arr[j] > arr[j-1]) {
  35. order = 0;
  36. }
  37. }
  38.  
  39. if(order == 1) cout<<"Sir Ordonat Strict Descrescator.";
  40. else
  41. cout<<"Sir Unordered.";
  42.  
  43. }
  44.  
  45.  
  46. }
  47.  
  48. }
  49.  
  50. int main(int argc, char const *argv[]) {
  51.  
  52. int arr[] = {11,7,6,5,4,3,2,1,0,-10}, n = sizeof(arr) / sizeof(arr[0]);
  53.  
  54. checkOrder(arr, n);
  55.  
  56. return 0;
  57. }
  58.  
Success #stdin #stdout 0s 5396KB
stdin
Standard input is empty
stdout
Sir Ordonat Strict Descrescator.