-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmathcalc.cpp
More file actions
38 lines (29 loc) · 816 Bytes
/
mathcalc.cpp
File metadata and controls
38 lines (29 loc) · 816 Bytes
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
#include <iostream>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <list>
#include <locale>
using namespace std;
#include "types.h"
#include "utils.h"
#include "bracket.h"
#include "calcurate.h"
int main(int argc, char *argv[])
{
struct PROGRESSION_FLAGS pflags;
string expressions;
if (argc == 1) {
cout << "usage: mathcalc [expression]" << endl;
return 0;
}
// Build expression array from string given from command-line
expressions = argv[1];
build_expressions(expressions, &pflags);
// Clean up bracket-wrapped expressions
exec_bracket_processing(&pflags);
// Last calcuration after cleaning up of brackets
cout << calcurate(pflags.expressions.begin(), pflags.expressions.end()) << endl;
return 0;
}