-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.cpp
More file actions
89 lines (84 loc) · 2.39 KB
/
Copy pathmenu.cpp
File metadata and controls
89 lines (84 loc) · 2.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
89
#include "hfile.h"
Menu::Menu(bool log_check, string path) ///\brief Menu class constructor, which initially reads information from a file
{
string vocabulary, word;
vector<string> str_rule;
ifstream a(path);
if (a.is_open())
{
a >> vocabulary;
a >> word;
while (!a.eof())
{
string b;
a >> b;
str_rule.push_back(b);
}
a.close();
Marcov_algorithm my_obj(vocabulary, word, str_rule, log_check);
this->obj = my_obj;
}
else cout << "file_error!";
}
void Menu::menu_choose() ///\brief action choise
///\details case 2 describes the menu for working with rules
///\details case 4 describes the menu for choosing how to perform an operator
{
while (true)
{
cout << "\nÂûáåðèòå äåéñòâèå: " << endl;
cout << "1.Çàãðóçèòü çàïèñü èç ïîòîêà;\n2.Ïðàâèëà;\n3.Èçìåíèòü ñëîâî;\n4.Èñïîëíåíèå àëãîðèòìà; \n5.Çàâåðøèòü ïðîãðàììó: ";
int choose;
cin >> choose;
switch (choose)
{
case 1:
obj.tape_state_form_stream();
break;
case 2:
cout << "\n1.Ïðîñìîòðåòü ïðàâèëà;\n2.Äîáàâèòü ïðàâèëî;\n3.Óäàëèòü ïðàâèëî: ";
int choose;
cin >> choose;
switch (choose)
{
case 1:
obj.get_rule();
break;
case 2:
obj.add_rule(obj.vocabulary);
break;
case 3:
obj.del_rule();
break;
}
break;
case 3:
obj.change_word();
break;
case 4:
if (obj.log_on_off == 0)
{
cout << "\nÂûáåðèòå ñïîñîá: " << endl << "1.Âñå îïåðàöèè ñðàçó ;\n2.Ïîøàãîâûå îïåðàöèè: ";
int choose_2;
cin >> choose_2;
switch (choose_2)
{
case 1:
obj.change_word_1(0);
obj.get_res();
break;
case 2:
obj.change_word_1(1);
break;
}
}
else
{
obj.change_word_1(0);
}
break;
case 5:
return;
}
}
}