Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void check(int A[10])
  5. {
  6. int m=0;
  7. int M=0;
  8.  
  9. for(int i=0 ; i<9 ; i++)
  10. {
  11. if(A[i]<A[i+1])
  12. m++;
  13. if(A[i]>A[i+1])
  14. M++;
  15. }
  16.  
  17. if(m==9)
  18. cout << "\n El arreglo esta ordenado de manera ascendente. \n";
  19. if(M==9)
  20. cout << "\n El arreglo esta ordenado de manera descendente. \n";
  21. if(m!=9 && M!=9)
  22. cout << "\n El arreglo esta desordenado. \n";
  23. }
  24.  
  25. int main()
  26. {
  27. int A[10];
  28.  
  29. cout << "Ingrese 10 valores para el arreglo: \n\n";
  30.  
  31. for(int i=0 ; i<10 ; i++)
  32. {
  33. cin >> A[i];
  34. cout << " ";
  35. }
  36.  
  37. check(A);
  38.  
  39. system("pause");
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement