Fixed code not computing the special operation properly
This commit is contained in:
+3
-3
@@ -47,10 +47,10 @@ ValidationResult validate_token(const std::string &token)
|
|||||||
|
|
||||||
|
|
||||||
if (digitpos == -1)
|
if (digitpos == -1)
|
||||||
return {true, ' ', 0};
|
return {true, token[0], 0};
|
||||||
|
|
||||||
int next = stoi(token.substr(digitpos));
|
int next = stoi(token.substr(digitpos));
|
||||||
return {true, ' ', next};
|
return {true, token[0], next};
|
||||||
}
|
}
|
||||||
|
|
||||||
Command resolveCommand()
|
Command resolveCommand()
|
||||||
@@ -72,7 +72,7 @@ Command resolveCommand()
|
|||||||
|
|
||||||
for (const char c: token)
|
for (const char c: token)
|
||||||
{
|
{
|
||||||
static const std::string operators {"+-*/%"};
|
static const std::string operators {"+-*/%$"};
|
||||||
if(operators.find(c) != operators.npos)
|
if(operators.find(c) != operators.npos)
|
||||||
{
|
{
|
||||||
operation = c;
|
operation = c;
|
||||||
|
|||||||
Reference in New Issue
Block a user