Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <locale.h>
- using namespace std;
- /*
- using namespace std;
- void DibujaCuadrado(string *cuadro, int n) {
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++) {
- cout << " " << *cuadro << " ";
- }
- cout << endl;
- }
- }
- int main() {
- int n;
- cout << "Ingrese un numero para calcular la dimencíón del cuadro: "; cin >> n;
- string* cuadro = new string;
- cout << "Ingrese la palabra: "; cin >> *cuadro;
- DibujaCuadrado(cuadro, n);
- _getch();
- return 0;
- }*/ // Problema 1 y 2
- void PosicionX(int x) {
- for (int i = 0; i < x; i++) {
- cout << " ";
- }
- }
- void PosicionY(int y) {
- for (int i = 0; i < y; i++) {
- cout << endl;
- }
- }
- void DibujarCuadro(int n, char *caracter) {
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++) {
- PosicionX;
- cout << *caracter;
- } PosicionY;
- }
- }
- int main() {
- setlocale(LC_CTYPE, "Spanish");
- int n, x, y;
- char *caracter = new char;
- cout << "Ingresla la dimesión del cuadrado: "; cin >> n;
- cout << "Ingresa la posición Y: "; cin >> y;
- cout << "Ingresa la posición X: "; cin >> x;
- cout << "Ingrese el carácter: "; cin >> *caracter;
- PosicionX(x);
- PosicionY(y);
- DibujarCuadro(n, caracter);
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement