-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (48 loc) · 1.39 KB
/
Copy pathmain.cpp
File metadata and controls
49 lines (48 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
#include "Function.h"
int main() {
int result , choice = 0;
pNode Tree = nullptr;
string s = {""};
printChoice();
while(choice != 7){
cout << "Enter your choice : ";
cin >> choice;
switch (choice){
case 1:
cout << "Enter your expression : ";
readFromKeyboard(s);
checkParentheses(s);
if(s.empty())
cout << "Invalid expression" << endl;
break;
case 2:
readFromFile(s);
cout << "Your expression : "<< s << endl;
checkParentheses(s);
if(s.empty())
cout << "Invalid expression" << endl;
break;
case 3:
writeToFile(s);
case 4:
if(s.size() != 0) {
Tree = makeTree(s);
}else
cout << "At first enter expression" << endl;
break;
case 5:
if(Tree) {
result = calc(Tree);
cout << s << " = " << result << endl;
} else
cout << "At first enter expression" << endl;
break;
case 6:
freeMem(Tree);
break;
case 7:
break;
}
}
return 0;
}