-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAINMENU.H
100 lines (88 loc) · 1.55 KB
/
MAINMENU.H
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
#include<iostream.h>
#include<bios.h>
#include<string.h>
#include<process.h>
#define MAX 4
class Menu
{
char **a;
public : void disp(int);
void setMenu(char*w,char*x,char*y,char*z)
{
a[0] = new char[strlen(w)+1];
strcpy(a[0],w);
a[1] = new char[strlen(x)+1];
strcpy(a[1],x);
a[2] = new char[strlen(y)+1];
strcpy(a[2],y);
a[3] = new char[strlen(z)+1];
strcpy(a[3],z);
}
int arrow();
};
void Menu :: disp(int n)
{
int i,x=26,y=11;
for(i=0;i<MAX;i++)
{
if(i==n)
{
textcolor(BLACK);
textbackground(WHITE);
}
else
{
textcolor(WHITE);
textbackground(5);
}
gotoxy(x,y);
cprintf(" <<< %s >>> ",a[i]);
y=y+2;
}
gotoxy(23,21);
textcolor(BROWN+BLINK);
textbackground(BLACK);
cprintf("PLEASE HIT <<< ENTER >>> TO GO ....!");
textcolor(WHITE);
}
int Menu :: arrow()
{
int i=0,ch,flag;
disp(i);
do
{
// flag=0;
ch=bioskey(0);
if(ch==18432)
i--;
if(ch==20480)
i++;
if(i==MAX)
i=0;
if(i==-1)
i=MAX-1;
if(ch==7181)
{
textbackground(0); //flag=1;
// clrscr();
break;
// return i;
// action(i);
}
disp(i);
}
while(ch!=7181);
// if(flag==1)
return i;
}
/*
int Menu :: action(int n)
{
switch(n)
{
case 0 : return 0;
case 1 : return 1;
case 2 : return 2;
default : exit(0);
}
} */