Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef CALCULATOR_H
- #define CALCULATOR_H
- class calculator {
- private:
- double accumulator = 0;
- public:
- void clear() {
- accumulator = 0;
- }
- double add(int num) {
- accumulator += num;
- }
- double sub(int num) {
- accumulator -= num;
- }
- double mul(int num) {
- accumulator *= num;
- }
- double div(int num) {
- accumulator /= num;
- }
- double get() {
- return accumulator;
- }
- void store() {
- double &accumaltor = accumulator;
- }
- double * recall() {
- return &accumulator;
- }
- };
- #endif //CALCULATOR_CALCULATOR_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement