This repository has been archived by the owner on May 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Group.cpp
104 lines (87 loc) · 1.71 KB
/
Group.cpp
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
#include"Prototype.h"
void InitTabGroup(TabGroup &g) {
g.groupname = "";
g.nTG = -1;
g.pos = -1;
}
bool IsGroup(TabGroup g) {
return (g.groupname != "");
}
void UnGroup(TabGroup &g) {
g.groupname = "";
}
bool GroupIsFull(TabGroup g) {
return (g.nTG == MAX - 1);
}
void CreateNewGroup(TabGroup &g) {
string a;
cout<<" => Now enter a new group name: ";
cin>>a;
g.groupname = a;
OpenGroup(g);
}
void DeleteGroup(TabGroup &g) {
for(int i=0; i<=g.nTG; i++) {
DeleteList(g.tabgroup[i]);
}
}
int GroupCount() {
int dem=0;
for(int i= 0 ; i <= nTL; i++)
if(tablist[i].groupname != "")
dem++;
return dem;
}
void ShowGroupList(int &dem, int vt[]) {
system("cls");
cout<<"\t[Group List]\n";
for(int i = 0; i<= nTL; i++) {
if(IsGroup(tablist[i])) {
dem++;
vt[dem]=i;
printf("[%d]. ",dem);
cout<<"[GROUP] "<<tablist[i].groupname<<endl;
}
}
}
void CloseGroup(TabGroup &g) {
if(nTL == 0) {
Exit();
} else {
Push(closedtab, g);
DeleteGroupFromTabList(g);
ShowTabList();
}
}
void OpenGroup(TabGroup &g) {
system("cls");
printf("[GROUP] [P%d]. ",g.pos+1);
cout<<g.groupname<<endl;
for(int i= 0; i<=g.nTG; i++) {
printf("[%d]. ",i+1);
cout<<g.tabgroup[i].present->address<<endl;
}
int o1 = g.nTG + 2;
int o2 = o1 + 1;
int o3 = o2 + 1;
printf("\n[%d]. ",o1);
cout<<"Change Group Name\n";
printf("[%d]. ",o2);
cout<<"Close Group\n";
printf("[%d]. ",o3);
cout<<"Back to Tab List\n";
int num;
InputNumber(num,1,o3);
if(num == o1) {
string a;
cout<<" => Now enter a new group name: ";
cin>>a;
g.groupname = a;
OpenGroup(g);
} else if(num == o2) {
CloseGroup(g);
} else if(num == o3)
ShowTabList();
else
ShowUnknownPage(g,g.tabgroup[num-1],g.tabgroup[num-1].present);
}