Advertisement
EricJohnson

Calculator

Mar 29th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. //Eric Johnson
  2. //Simple Calculator
  3. //03-27-12
  4. #include <iostream>
  5. #include <math>
  6. #include "calc_func.hpp"
  7. #include "clear.hpp"
  8. using namespace std;
  9. int main()
  10. {
  11. char operation;
  12. double a, b, answer;
  13. cout << "Please input the first operand: ";
  14. cin >> a;
  15. clear();
  16. cout << "Please input the second operand: ";
  17. cin >> b;
  18. clear();
  19. cout << "Please input the operation you wish to perform: "
  20. cin >> operation
  21. switch (operation)
  22. {
  23.     case (a):
  24.         add();
  25.         break;
  26.     case (m):
  27.         multiply();
  28.         break;
  29.     case (d):
  30.         divide();
  31.         break;
  32.     case (s):
  33.         subtract();
  34.         break;
  35.     case (p):
  36.         AtoB();
  37.         break;
  38.     case (r):
  39.         BtoA();
  40.         break;
  41. }
  42. cout << "\nThese are you operands: " << a << "&: " << b << endl;
  43. cout << "This is the answer to your problems: " << answer << endl;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement