19 lines
551 B
C++
19 lines
551 B
C++
|
#include <iostream>
|
||
|
#include "Calculator.h"
|
||
|
using namespace std;
|
||
|
|
||
|
double value;
|
||
|
// TODO: Define default constructor
|
||
|
Calculator::Calculator(){
|
||
|
value = 0;
|
||
|
}
|
||
|
// TODO: Define member functions -
|
||
|
// Add(), Subtract(), Multiply(), Divide(), Clear(), GetValue()
|
||
|
|
||
|
void Calculator::Add(double n) { value += n; }
|
||
|
void Calculator::Subtract(double n) { value -= n; }
|
||
|
void Calculator::Multiply(double n) { value *= n; }
|
||
|
void Calculator::Divide(double n) { value /= n; }
|
||
|
void Calculator::Clear() { value = 0; }
|
||
|
double Calculator::GetValue(){ return value; }
|