Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. public string Mostrar()
  2. {
  3. string salida = "";
  4. if (!(EstaVacio()))
  5. {
  6. string contenido = "Contenido: { ";
  7. string posicion = "Posición: [ ";
  8. string indice = "Indice: [ ";
  9. for (int i = 0; i < arreglo.Length; i++)
  10. {
  11. contenido += arreglo[i];
  12. posicion += new string(' ', arreglo[i].ToString().Length - i.ToString().Length) + i;
  13. //Indice
  14. if (i == top)
  15. indice += new string(' ', arreglo[i].ToString().Length - 1) + "T";
  16. else
  17. {
  18. if (i < this.top)
  19. indice += new string(' ', arreglo[i].ToString().Length - 1) + "C";
  20. else
  21. indice += new string(' ', arreglo[i].ToString().Length);
  22. }
  23. //Comas
  24. if (i != arreglo.Length - 1)
  25. {
  26. contenido += ", ";
  27. posicion += ", ";
  28. indice += " ";
  29. }
  30. }//Fin For
  31. contenido += " }";
  32. posicion += ", " + this.max + "]";
  33. if (top == max)
  34. {
  35. indice += " T]";
  36. }
  37. else
  38. indice += " ]";
  39.  
  40. salida = contenido + "\n" + posicion + "\n" + indice + "\n";
  41. salida += "C: Indica las celdas con contenido; T indica la posición de TOP\n";
  42.  
  43.  
  44. return salida;
  45. }
  46. else
  47. salida = "Arreglo Vacío";
  48. return salida;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement