home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Examples / AppKit / CalculatorLab++ / CalcEngine.h < prev    next >
C/C++ Source or Header  |  1990-10-28  |  681b  |  32 lines

  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.  
  32.