include stdio include conio int pos int change char name lab1 lab2 lab

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#include<stdio.h>
#include<conio.h>
int pos=6;
int change[7][4]=
{
{0,1,2,0},{1,1,3,0},{0,6,4,2},{1,3,5,6},{2,5,4,4},{3,5,5,4},{0,3,4,2}
};
char name[7][5]={"lab1","lab2","lab3","lab4","lab5","lab6","HELP"};
int coord[7][2]=
{
{30,9},{37,9},{27,11},{41,11},{30,13},{37,13},{34,11}
};
int print_menu2();
int print_menu();
void redraw();
int swap();
int use();
int bg_w();
void main()
{
textbackground(WHITE);
clrscr();
for(;;)
{
print_menu2();
redraw();
}
}
int print_menu2()
{
int i;
window(1,1,80,25);
textbackground(WHITE);
clrscr();
//textcolor(BLACK);
for(i=0;i<7;i++)
{
textbackground(i==pos?GREEN:WHITE);
textcolor(i==pos?BLACK:RED);
//cputs(name[i]);
window(coord[i][0],coord[i][1],coord[i][0]+7,coord[i][1]);
clrscr();
cprintf(" %s",name[i]);
}
//for(j=0;j<4;j++)putch(name[i][j]);
}
print_menu()
{
int i;
window(1,1,50,15);
textbackground(BLUE);
clrscr();
for(i=0;i<7;i++)
{
gotoxy(coord[i][0],coord[i][1]);
textcolor(i==pos?RED:YELLOW);
//textbackground(i==pos?WHITE:BLACK);
cputs(name[i]);
//cprintf(name[i]);
//for(j=0;j<4;j++)putch(name[i][j]);
}
}
void redraw()
{
gotoxy(coord[pos][0],coord[pos][1]);
textcolor(YELLOW);
// cputs(name[pos]);
swap();
gotoxy(coord[pos][0],coord[pos][1]);
textcolor(RED);
// cputs(name[pos]);
}
int swap()
{
int key;
key=getch();
if(key==224)
key=getch();
switch(key)
{
case 72:pos=change[pos][0];break;
case 77:pos=change[pos][1];break;
case 80:pos=change[pos][2];break;
case 75:pos=change[pos][3];break;
case 13:use();break;
case 27:exit();
}
return 0;
}
int use()
{
FILE *f;char *symb;
int klav;
window(1,1,80,25);
textbackground(BLUE);
clrscr();
switch(pos)
{
case 6:
gotoxy(25,7);
if((f=fopen("E:\HELP.txt","rt"))==NULL)
{
cprintf("error=HELP.txt");
getch();
clrscr();
print_menu2();
}
else
{
while(feof(f)!=1)
{
cprintf("%c",&symb);
}
getch();
clrscr();
print_menu2();
}
case 0: case 1: case 2: case 3:
case 4: case 5: clrscr();
gotoxy(30,12);
cprintf("lab %d ne gotova",pos+1);
klav=getch();
if(klav==224)
klav=getch();
clrscr();
print_menu2();
}
return;
}
void bg_w() //
{
int i;
window(2,2,79,24);
textbackground(BLUE);
textcolor(GREEN);
clrscr();
puts(" ╔══════════════════════════════════════════════════════════════════════════╗ ");
for(i=0;i<=20;i++)
puts(" ║ ║ ");
puts(" ╚══════════════════════════════════════════════════════════════════════════╝ ");
}