daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Dec 9th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma once
  2.  
  3.  
  4.  
  5. #include "stdafx.h"
  6. #include "parseStrategy.h"
  7. #include <map>
  8. using namespace std;
  9.  
  10.  
  11. class Calculatable {
  12. public:
  13.     virtual int calculate(int a, int b) = 0;
  14. };
  15.  
  16. class addable : public Calculatable {
  17. public:
  18.     int calculate(int a, int b);
  19. };
  20.  
  21. class subtractable : public Calculatable {
  22. public:
  23.     int calculate(int a, int b);
  24. };
  25.  
  26. class dividable : public Calculatable {
  27. public:
  28.     int calculate(int a, int b);
  29. };
  30.  
  31. class multipliable : public Calculatable {
  32. public:
  33.     int calculate(int a, int b);
  34. };
  35.  
  36. class exponentiation : public Calculatable {
  37. public:
  38.     int calculate(int a, int b);
  39. };
  40.  
  41. class Calculator {
  42. protected:
  43.     int memory;
  44.     parseStrategy* ps;
  45.    
  46. private:
  47.     map<char, Calculatable*> maps;
  48. public:
  49.     Calculator();
  50.     void setParser(parseStrategy* strat);
  51.     void addOperation(char a, Calculatable* b);
  52.     int calculate(char c, int i1, int i2);
  53.     int calculate(string s);
  54. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top