Advertisement
Guest User

Ejercicio Punteros Saber si esta ordenado

a guest
Jan 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5. using namespace System;
  6.  
  7. bool verificacion (int *numeros)
  8. {
  9. for (int i = 0; i <= 6 - 1; i++)
  10. {
  11. for (int j = i + 1; j < 6; j++)
  12. {
  13. if (numeros[i] > numeros[j])
  14. return false;
  15.  
  16. }
  17. }
  18. return true;
  19. }
  20.  
  21.  
  22. int main ()
  23. {
  24. int *numeros;
  25. numeros = new int[6];
  26.  
  27. for (int i = 0; i < 6; i++)
  28. {
  29. cout << "Ingrese el numero " << i << ": ";
  30. cin >> numeros[i];
  31. }
  32.  
  33. if (verificacion(numeros))
  34. cout << "Los numeros estan en orden";
  35. else
  36. cout << "Los numeros estan en desorden";
  37.  
  38.  
  39.  
  40.  
  41. _getch();
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement