Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void check(int A[10])
- {
- int m=0;
- int M=0;
- for(int i=0 ; i<9 ; i++)
- {
- if(A[i]<A[i+1])
- m++;
- if(A[i]>A[i+1])
- M++;
- }
- if(m==9)
- cout << "\n El arreglo esta ordenado de manera ascendente. \n";
- if(M==9)
- cout << "\n El arreglo esta ordenado de manera descendente. \n";
- if(m!=9 && M!=9)
- cout << "\n El arreglo esta desordenado. \n";
- }
- int main()
- {
- int A[10];
- cout << "Ingrese 10 valores para el arreglo: \n\n";
- for(int i=0 ; i<10 ; i++)
- {
- cin >> A[i];
- cout << " ";
- }
- check(A);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement