Compare commits
2 Commits
d366d15de3
...
688f490ec1
| Author | SHA1 | Date | |
|---|---|---|---|
| 688f490ec1 | |||
| 6f6ea77e69 |
@@ -1,3 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
enum class OpType
|
enum class OpType
|
||||||
{
|
{
|
||||||
Addition, Subtraction, Multiplication, Division, Modulo, Special
|
Addition, Subtraction, Multiplication, Division, Modulo, Special
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#include "Operation.h"
|
#include "Operation.h"
|
||||||
class BaseCalculator
|
class BaseCalculator
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-1
@@ -1,6 +1,7 @@
|
|||||||
#include "input_resolver.h"
|
#include "input_resolver.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#define delimiter " "
|
#define delimiter " "
|
||||||
|
|
||||||
@@ -63,7 +64,9 @@ Command resolveCommand()
|
|||||||
auto validation_result = validate_token(token);
|
auto validation_result = validate_token(token);
|
||||||
if (!validation_result.ok())
|
if (!validation_result.ok())
|
||||||
{
|
{
|
||||||
throw std::runtime_error{"invalid token " + validation_result.incorrect_token()};
|
std::ostringstream os;
|
||||||
|
os << "invalid token "<< validation_result.incorrect_token();
|
||||||
|
throw std::runtime_error{os.str()};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldQuit = token.find("q") != token.npos;
|
bool shouldQuit = token.find("q") != token.npos;
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
Command resolveCommand();
|
Command resolveCommand();
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#include "basecalc.h"
|
#include "basecalc.h"
|
||||||
|
|
||||||
class SpecialCalculator: public BaseCalculator
|
class SpecialCalculator: public BaseCalculator
|
||||||
|
|||||||
Reference in New Issue
Block a user