Advertisement
Johnqc

Semana9 sesión 2

May 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <string>
  4. using namespace std;
  5.  
  6. /*
  7. using namespace std;
  8. void DibujaCuadrado(string *cuadro, int n) {
  9. for (int i = 0; i < n; i++) {
  10. for (int j = 0; j < n; j++) {
  11. cout << " " << *cuadro << " ";
  12. }
  13. cout << endl;
  14. }
  15.  
  16.  
  17. }
  18. int main() {
  19. int n;
  20. cout << "Ingrese un numero para calcular la dimencíón del cuadro: "; cin >> n;
  21. string* cuadro = new string;
  22. cout << "Ingrese la palabra: "; cin >> *cuadro;
  23.  
  24. DibujaCuadrado(cuadro, n);
  25.  
  26.  
  27.  
  28.  
  29.  
  30. _getch();
  31. return 0;
  32. }*/ // Problema 1 y 2
  33.  
  34. void PosincionX() {
  35. int x;
  36. cout << "Ingresa la posición X: "; cin >> x;
  37. for (int i = 0; i < x; i++) {
  38. cout << " ";
  39. }
  40. }
  41.  
  42.  
  43. void PosicionY() {
  44. int y;
  45. cout << "Ingresa la posición Y: "; cin >> y;
  46. for (int i = 0; i < y; i++) {
  47. cout << endl;
  48. }
  49.  
  50. }
  51.  
  52. void DibujarCuadro(int n) {
  53. char *caracter = new char;
  54. cout << "Ingrese el carácter: "; cin >> *caracter;
  55. for (int i = 0; i < n; i++) {
  56. for (int j = 0; j < n; j++) {
  57. cout << *caracter;
  58. } cout << endl;
  59. }
  60. }
  61.  
  62.  
  63. int main() {
  64. int n;
  65. cout << "Ingresla la dimesión del cuadrado: "; cin >> n;
  66. PosicionY();
  67. PosicionY();
  68. DibujarCuadro(n);
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. _getch();
  76. return 0;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement