int main() { _gotoxy(10, 10); //Does not compile _textcolor(YELLOW); //Does not compile _textbackground(BLUE); //Does not compile _cputs("Hello"); }
void horzLine(int x, int y, int length, char sym, int color) /* horzLine() definition */ { int i; _gotoxy(x, y); /* _gotoxy() function puts cursor and specific x and y coordinates on output screen */ _textcolor(color); /* _textcolor() changes the color of text on output screen based on numbers 0 - 15 */ for (i = 0; i < length; ++i) printf("%c",sym); fflush(stdout); /* fflush(stdout) forces characters on the output screen (like a refresh for placeholders) */ }
void vertLine(int x, int y, int length, char sym, int color) /* vertLine() definition */ { int i; _textcolor(color); for (i = 0; i < length; ++i) { _gotoxy(x, i + y); printf("%c",sym); } fflush(stdout); }
int main(void) { int b; horzLine (5, 1, 10, '*', RED); /* horzLine() function call */ vertLine (1, 1, 5, '#', GREEN); /* vertLine() function call */ boxFilled (18, 1, 5, 4, '=', MAGENTA); /* boxFilled() function call */ boxOpen (30, 1, 5, 4, '+', BLUE); /* boxOpen() function call */ /*********************************************************/ /* business drawing section */ vertLine (5, 10, 14, '|', WHITE); horzLine (5, 23, 70, '_', WHITE); for (b = 0; b < 13; b = 2 + b) horzLine (4, 21 - b, 1, '_', WHITE); for (b = 0; b < 13; b = 2 + b) horzLine (3, 21 - b, 1, '$', WHITE); for (b = 0; b < 68; b = 2 + b) vertLine (73 - b, 24, 1, '|', WHITE); boxFilled (6, 10, 69, 13, '.', BLUE); boxOpen (5, 6, 70, 3, '*', BLUE); _gotoxy(6,7); _textcolor(YELLOW); printf("----------------------------STOCK CHART-----------------------------"); horzLine (6, 20, 10, '_', YELLOW); vertLine (16, 16, 5, '|', YELLOW); horzLine (17, 15, 5, '_', YELLOW); vertLine (22, 16, 2, '|', YELLOW); horzLine (23, 17, 10, '_', YELLOW); vertLine (33, 18, 4, '|', YELLOW); horzLine (34, 21, 10, '_', YELLOW); vertLine (44, 17, 5, '|', YELLOW); horzLine (45, 16, 20, '_', YELLOW); for (b = 0; b < 5; ++b) /*************************/ horzLine (66 + 2 * b - 1, 15 - b, 1, '_', YELLOW); /* */ /* draws a diagonal line */ for (b = 0; b < 6; ++b) /* */ vertLine(65 + 2 * b - 1, 16 - b, 1, '|', YELLOW); /*************************/ return 0; }
int main () { _textcolor (12); srand (time (0)); int cell [2] [80]; int switcher = 0; int line = 1; int sum; int i; char input; start: _clrscr (); switcher = 0; line = 1; for (i = 0; i < 80; ++i) { cell [0] [i] = 0; cell [1] [i] = 0; } _gotoxy (1, line); for (i = 0; i < 80; ++i) { cell [switcher] [i] = rand () % 2; if (cell [switcher] [i] == 1) { printf ("%c", OUTPUT); } else { printf (" "); } } while (1) { sleepx (500); switcher = !switcher; ++line; _gotoxy (1, line); for (i = 0; i < 80; ++i) { sum = cell [!switcher] [(i-2) % 80] + cell [!switcher] [(i-1) % 80] + cell [!switcher] [(i+1) % 80] + cell [!switcher] [(i+2) % 80]; if (sum == PLUS1 || sum == PLUS2) { cell [switcher] [i] = 1; printf ("%c", OUTPUT); } else { cell [switcher] [i] = 0; printf (" "); } } if (_kbhit()) { input = _getch (); if (input == ' ') _getch (); else if (input == 27) break; else if (input == '\r') goto start; } } _getch (); return 0; }