Advertisement
Guest User

PUNTEROS

a guest
May 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void DibujaCuadrado(short* n, float* p, short* x, short* y) {
  5.  
  6. for (short b = 1; b <= *y; b++) {
  7. cout << endl;
  8. }
  9.  
  10. for (short i = 1; i <= *p; i++) {
  11.  
  12. for (short a = 1; a <= *x; a++) {
  13. cout << " ";
  14. }
  15.  
  16. for (short j = 1; j <= *p; j++) {
  17. cout << *n << " ";
  18. }
  19. if (*n >= 10) {
  20. cout << endl;
  21. }
  22. cout << endl;
  23. }
  24. }
  25.  
  26.  
  27.  
  28. int main() {
  29. short* n = new short;
  30. cout << "Ingrese el numero a mostrar: ";
  31. cin >> *n;
  32.  
  33. float* p = new float[*n];
  34. cout << "Ingrese el lado del cuadrado: ";
  35. cin >> *p;
  36.  
  37. short* x = new short;
  38. cout << "Ingrese coordenadas x ";
  39. cin >> *x;
  40.  
  41. short* y = new short;
  42. cout << "Ingrese coordenadas y ";
  43. cin >> *y;
  44.  
  45. cout << endl;
  46. cout << endl;
  47. DibujaCuadrado(n, p, x, y);
  48.  
  49. delete p;
  50. delete n;
  51. delete x;
  52. delete y;
  53. cout << endl;
  54.  
  55. system("pause");
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement