Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
150
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.  
  7. string contenido = "Contenido: { ";
  8. string posicion = "Posición: [ ";
  9. string indice = "Indice: [ ";
  10.  
  11. for (int i = 0; i < arreglo.Length; i++)
  12. {
  13. contenido += arreglo[i];
  14. posicion += new string(' ', arreglo[i].ToString().Length - i.ToString().Length) + i;
  15. //Indice
  16. if (i == top)
  17. indice += new string(' ', arreglo[i].ToString().Length - 1) + "T";
  18. else
  19. {
  20. if (i < this.top)
  21. indice += new string(' ', arreglo[i].ToString().Length - 1) + "C";
  22. else
  23. indice += new string(' ', arreglo[i].ToString().Length);
  24. }
  25.  
  26. //Comas
  27. if (i != arreglo.Length - 1)
  28. {
  29. contenido += ", ";
  30. posicion += ", ";
  31. indice += " ";
  32. }
  33. }//Fin For
  34.  
  35. contenido += " }";
  36. posicion += ", " + this.max + "]";
  37. if (top == max)
  38. {
  39. indice += " T]";
  40. }
  41. else
  42. indice += " ]";
  43.  
  44. salida = contenido + "\n" + posicion + "\n" + indice + "\n";
  45. salida += "C: Indica las celdas con contenido; T indica la posición de TOP\n";
  46.  
  47.  
  48. return salida;
  49. }
  50. else
  51. salida = "Arreglo Vacío";
  52. return salida;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement