Xavistian

Cuadrado funcion color setcursorposition

May 18th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. // ConsoleApplication3.cpp : main project file.
  2.  
  3. #include "stdafx.h"
  4. #include <iostream>
  5. #include <conio.h>
  6. using namespace std;
  7. using namespace System;
  8. void DibujaRectangulo(char c, int x, int y, int color, int an, int al)
  9. {
  10. Console::ForegroundColor = (ConsoleColor)color;
  11.     for (int i = 0; i < al; i++)
  12.     {
  13.     Console::SetCursorPosition(x, y);
  14.         for (int q = 0; q < an; q++) { cout << c; }
  15.         y++;
  16.     }
  17. }
  18. int main()
  19. {
  20.     char c;
  21.     int x, y, color, an, al;
  22.     cout << "Ingrese el caracter a imprimir: " << endl;
  23.     cin >> c;
  24.     cout << "Ingrese las coordenadas x y y: " << endl;
  25.     cin >> x >> y;
  26.     cout << "Ingrese el color del texto: " << endl;
  27.     cin >> color;
  28.     cout << "Ingrese el ancho y el alto: " << endl;
  29.     cin >> an >> al;
  30.     DibujaRectangulo(c, x, y, color, an, al);
  31.     getch();
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment