Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3. using namespace std;
  4. void DrawHLine(int row, int color)
  5. {
  6.    
  7.     HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // get a handle for the screen
  8.     SetConsoleTextAttribute(screen, color|FOREGROUND_INTENSITY);
  9.     COORD pos;
  10.     pos.Y = row;
  11.     for (int i=0; i<71; i++)
  12.     {
  13.         pos.X = i;
  14.         SetConsoleCursorPosition(screen, pos);
  15.         cout << "*";
  16.     }
  17.  
  18. }
  19. void DrawVLine(int col, int color)
  20. {
  21.     HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // get a handle for the screen
  22.     SetConsoleTextAttribute(screen, color|FOREGROUND_INTENSITY);
  23.     COORD pos;
  24.     pos.X = col;
  25.     for (int i=0; i<25; i++)
  26.     {
  27.         pos.Y = i;
  28.         SetConsoleCursorPosition(screen, pos);
  29.         cout << "*";
  30.     }
  31. }
  32. int main (){
  33.  
  34.    
  35.     for (int i=0; i<5; i++)
  36.         DrawHLine((25/4)*i,FOREGROUND_GREEN);
  37.    
  38.     for (int i=0; i<8; i+=2)
  39.         DrawVLine((71/7)*i,FOREGROUND_RED);
  40.  
  41.     for (int i=1; i<8; i+=2)
  42.         DrawVLine((71/7)*i,FOREGROUND_BLUE);
  43.  
  44.     // hold the screen from closing
  45.     int a;
  46.     cin>> a;
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement