VFPU derpage fixed
[ipdf/code.git] / src / tests / calculator.cpp
diff --git a/src/tests/calculator.cpp b/src/tests/calculator.cpp
new file mode 100644 (file)
index 0000000..89009f1
--- /dev/null
@@ -0,0 +1,43 @@
+#include "main.h"
+#include "real.h"
+#include <cmath>
+#include <cassert>
+#include <list>
+#include <bitset>
+#include <iostream>
+
+using namespace std;
+using namespace IPDF;
+
+int main(int argc, char ** argv)
+{
+       while (true)
+       {
+               double da; double db;
+               char op;
+               cin >> da >> op >> db;
+               
+               Real a(da);
+               Real b(db);
+               
+               Real c;
+               switch (op)
+               {
+                       case '+':
+                               c = a + b;
+                               break;
+                       case '-':
+                               c = a - b;
+                               break;
+                       case '*':
+                               c = a * b;
+                               break;
+                       case '/':
+                               c = a / b;
+                               break;
+               }
+               
+               cout << Double(c) << '\n';
+               
+       }
+}

UCC git Repository :: git.ucc.asn.au