Язык Turbo C 2.0Текстовый режимНачальный курс C и C++ */#include <conio.h>main (){int a, b;char d;char g [288];char *j = " Это строка. ";/* 150.54.1 */textmode (C80);for (a = BLUE; a <= WHITE; a++){for (b = BLACK; b <= LIGHTGRAY; b++){textcolor (a);textbackground (b);cprintf (" тест ");}cprintf ("\n");}textcolor (WHITE|BLINK);textbackground (BLACK);cprintf (" Конец текста ");textmode (LASTMODE);getch ();/* 152.55.2 */textbackground (BLACK);clrscr ();window (5, 5, 20, 10);textattr ((GREEN << 4) + RED);clrscr ();cputs ("\n Привет, мир. \n\n\r");textattr ((GREEN << 4) + RED + BLINK);cputs (" Нажми любую клавишу . . . ");getch ();window (1, 1, 80, 25);gettext (4, 4, 21, 11, g);textbackground (BLUE);textcolor (WHITE);for (a = 1; a < 23; a++){gotoxy (1, a);cputs (j); cputs (j); cputs (j); cputs (j);}getch ();puttext (24, 5, 41, 12, g);getch ();for (a = 1; a < 5; a++)movetext (22, 4, 32, 8, 10 * a, 17);getch ();normvideo ();/* 53.1.3 */clrscr ();gotoxy (40, 13);putch ('*');getch ();/* 54.2.4 */window (1, 1, 40, 12);textbackground (WHITE); clrscr ();window (41, 1, 80, 12);textbackground (RED); clrscr ();window (1, 13, 40, 25);textbackground (LIGHTRED); clrscr ();window (41, 13, 80, 25);textbackground (GREEN); clrscr ();getch ();/* 55.3.5 */textbackground (WHITE);clrscr ();gotoxy (1, 12);for (a = 0; a < 16; a++){textcolor (a);cprintf ("%i ", a);}/* 56.4.6 */getch ();window (1, 1, 80, 25);textcolor (YELLOW);textbackground (BLACK);clrscr ();}
Электронника и программирование
:Юрий Казекин
/* p150
Язык Turbo C 2.0
Текстовый режим
Начальный курс C и C++ */
#include <conio.h>
main ()
{
int a, b;
char d;
char g [288];
char *j = " Это строка. ";
/* 150.54.1 */
textmode (C80);
for (a = BLUE; a <= WHITE; a++)
{
for (b = BLACK; b <= LIGHTGRAY; b++)
{
textcolor (a);
textbackground (b);
cprintf (" тест ");
}
cprintf ("\n");
}
textcolor (WHITE|BLINK);
textbackground (BLACK);
cprintf (" Конец текста ");
textmode (LASTMODE);
getch ();
/* 152.55.2 */
textbackground (BLACK);
clrscr ();
window (5, 5, 20, 10);
textattr ((GREEN << 4) + RED);
clrscr ();
cputs ("\n Привет, мир. \n\n\r");
textattr ((GREEN << 4) + RED + BLINK);
cputs (" Нажми любую клавишу . . . ");
getch ();
window (1, 1, 80, 25);
gettext (4, 4, 21, 11, g);
textbackground (BLUE);
textcolor (WHITE);
for (a = 1; a < 23; a++)
{
gotoxy (1, a);
cputs (j); cputs (j); cputs (j); cputs (j);
}
getch ();
puttext (24, 5, 41, 12, g);
getch ();
for (a = 1; a < 5; a++)
movetext (22, 4, 32, 8, 10 * a, 17);
getch ();
normvideo ();
/* 53.1.3 */
clrscr ();
gotoxy (40, 13);
putch ('*');
getch ();
/* 54.2.4 */
window (1, 1, 40, 12);
textbackground (WHITE); clrscr ();
window (41, 1, 80, 12);
textbackground (RED); clrscr ();
window (1, 13, 40, 25);
textbackground (LIGHTRED); clrscr ();
window (41, 13, 80, 25);
textbackground (GREEN); clrscr ();
getch ();
/* 55.3.5 */
textbackground (WHITE);
clrscr ();
gotoxy (1, 12);
for (a = 0; a < 16; a++)
{
textcolor (a);
cprintf ("%i ", a);
}
/* 56.4.6 */
getch ();
window (1, 1, 80, 25);
textcolor (YELLOW);
textbackground (BLACK);
clrscr ();
}