Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- using namespace std;
- void DrawHLine(int row, int color)
- {
- HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // get a handle for the screen
- SetConsoleTextAttribute(screen, color|FOREGROUND_INTENSITY);
- COORD pos;
- pos.Y = row;
- for (int i=0; i<71; i++)
- {
- pos.X = i;
- SetConsoleCursorPosition(screen, pos);
- cout << "*";
- }
- }
- void DrawVLine(int col, int color)
- {
- HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // get a handle for the screen
- SetConsoleTextAttribute(screen, color|FOREGROUND_INTENSITY);
- COORD pos;
- pos.X = col;
- for (int i=0; i<25; i++)
- {
- pos.Y = i;
- SetConsoleCursorPosition(screen, pos);
- cout << "*";
- }
- }
- int main (){
- for (int i=0; i<5; i++)
- DrawHLine((25/4)*i,FOREGROUND_GREEN);
- for (int i=0; i<8; i+=2)
- DrawVLine((71/7)*i,FOREGROUND_RED);
- for (int i=1; i<8; i+=2)
- DrawVLine((71/7)*i,FOREGROUND_BLUE);
- // hold the screen from closing
- int a;
- cin>> a;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement