vector<string> ExprTree::tokenise(string expression){
vector<string> store;
string s;
std::stringstream in(expression);
while(in >> s) {
store.push_back(s);
}
return store;
}
When i input the arithmetic expression (5 + 5) + 5
i get the output:
(5
+
5)
+
5
However i want:
(
5
+
5
)
+
5
Also, the code only separates the strings between whitespaces, is it possible to tokenise a string that is written without whitespaces? i.e (5+5)+5