|
|
1.1 ! root 1: // ! 2: // CalcEngine -- mem ! 3: // A general C++ class that directly supports a calculator interface ! 4: // ! 5: // You may freely copy, distribute and reuse the code in this example. ! 6: // NeXT disclaims any warranty of any kind, expressed or implied, as to ! 7: // its fitness for any particular use. ! 8: // ! 9: // Created 8-21-90 ! 10: // ! 11: ! 12: enum ops { ! 13: DIVIDE = 20, ! 14: MULTIPLY = 21, ! 15: SUBTRACT = 22, ! 16: ADD = 23 ! 17: }; ! 18: ! 19: class CalcEngine ! 20: { ! 21: enum ops op; ! 22: double accumulator; // result of the mathematics ! 23: ! 24: public: ! 25: CalcEngine(); // C++ constructor ! 26: void clear(); ! 27: void setOperation(int whichOp); ! 28: double equalsKey(double secondNum); ! 29: double operationKeys(int whichOp, double firstNum); ! 30: }; ! 31:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.