-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
55 lines (47 loc) · 1.68 KB
/
main.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
#include <iomanip>
#include <iostream>
#include <string>
#include "BODMASS_Calculator.h"
/**
+ : Addition
- : Subtraction or Unary Minus
* : Multiplication
/ : Division
% : Modulo or remainder operator
** : Power
& : Bitwise AND
| : Bitwise OR
^ : Bitwise XOR
<< : Bitwise left shift operator
>> : Bitwise right shift operator
*/
// Function to print the list of operators available
void printListOfOperators() {
std::cout << "Here is the list of operators you can use..." << std::endl
<< std::endl;
std::cout << " + : Addition" << std::endl;
std::cout << " - : Subtraction or Unary Minus" << std::endl;
std::cout << " * : Multiplication" << std::endl;
std::cout << " / : Division" << std::endl;
std::cout << " % : Modulo or remainder operator" << std::endl;
std::cout << " ** : Power" << std::endl;
std::cout << " & : Bitwise AND" << std::endl;
std::cout << " | : Bitwise OR" << std::endl;
std::cout << " ^ : Bitwise XOR" << std::endl;
std::cout << " << : Bitwise left shift operator" << std::endl;
std::cout << " >> : Bitwise right shift operator" << std::endl;
std::cout << std::endl
<< std::endl;
}
int main() {
printListOfOperators();
std::string expr{};
std::cout << "Enter the expression to evaluate : " << std::endl;
std::cin >> expr;
BODMASS_Calculator expression{expr};
//std::cout << "Brackets Matching: " << std::boolalpha << expression.areBracketsMatching() << std::endl;
//std::cout << "Postfix : " << expression.postfix() << std::endl;
std::cout << "Value : " << expression.value() << std::endl;
std::cout << std::endl;
return 0;
}