-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu_books.cpp
More file actions
88 lines (82 loc) · 1.39 KB
/
menu_books.cpp
File metadata and controls
88 lines (82 loc) · 1.39 KB
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
#include "default.h"
#include "menu.h"
int current_books = 0;
bool menuBooks()
{
bool end = 0;
char symbol;
int current_max = 4;
menuBooks_render(current_books);
symbol = _getch();
switch (symbol)
{
case 72: // êëàâèøà ââåðõ
if (current_books > 0)
current_books--;
else
current_books = current_max;
break;
case 80: // êëàâèøà âíèç
if (current_books < current_max)
current_books++;
else
current_books = 0;
break;
case 13: // êëàâèøà ââîä
switch (current_books)
{
case 0:
cout << "Add user todo";
break;
case 1:
cout << "Edit user todo";
break;
case 2:
cout << "Delete user todo";
break;
case 3:
cout << "Find user todo";
break;
case 4:
end = 1;
cls();
break;
}
break;
case 27: // êëàâèøà esc
end = 1;
break;
default:
//cout << (int)symbol;
break;
}
// Ââîä äàííûõ
return end;
}
int menuBooks_render(int current)
{
cls();
setColor(0, 15);
cout << "Choose menu option:" << endl;
setColor(1, 15);
if (current == 0)
setColor(15, 0);
cout << "Add book" << endl;
setColor(1, 15);
if (current == 1)
setColor(15, 0);
cout << "Edit book" << endl;
setColor(1, 15);
if (current == 2)
setColor(15, 0);
cout << "Delete book" << endl;
setColor(1, 15);
if (current == 3)
setColor(15, 0);
cout << "Find book" << endl;
setColor(1, 15);
if (current == 4)
setColor(15, 0);
cout << "Back " << endl;
return current;
}