Advertisement
Guest User

COVER

a guest
Sep 17th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <windows.h>
  3. #include <stdlib.h>
  4.  
  5. void f(char c, short x, short y, short color) {
  6.     HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  7.     COORD coord = { x, y };
  8.     SetConsoleTextAttribute(hConsole, color);
  9.     SetConsoleCursorPosition(hConsole, coord);
  10.     printf("%c", c);
  11.     Sleep(0);
  12. }
  13.  
  14. int main() {
  15.     int col = 2;
  16.     int s = 79;
  17.     for (int i = 2; i < 78; i++) {
  18.         for (int j = 2; j < 18; j++) {
  19.             f(s, i, j, rand(4));
  20.         }
  21.     }
  22.     for (int i = 1; i < 20; i++) {
  23.         s = 124;
  24.         f(s, 1, i, col);
  25.         f(s, 79, i, col);
  26.     }
  27.     for (int i = 1; i < 80; i++) {
  28.         s = 45;
  29.         f(s, i, 1, col);
  30.         f(s, i, 19, col);
  31.     }
  32.     s = 79;
  33.     f(s, 0, 0, col);
  34.     f(s, 80, 0, col);
  35.     f(s, 80, 20, col);
  36.     f(s, 0, 20, col);
  37.     s = 65;
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement