Advertisement
EricJohnson

Untitled

Mar 30th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  9. using namespace std;
  10. int main()
  11. {
  12. char operation;
  13. double a, b, answer;
  14. cout << "Please input the first operand: ";
  15. cin >> a;
  16. clear();
  17. cout << "Please input the second operand: ";
  18. cin >> b;
  19. clear();
  20. int lookup[]=
  21.         {
  22.         (operation = "a"),(operation = "m"),(operation = "d"),(operation = "s"),
  23.         (operation = "p"),(operation = "r"),
  24.         };
  25. cout << "Please choose the operation you would like to perform: " << endl;
  26. cin >> operation ;
  27. switch (lookup)
  28. {
  29.     case (a):
  30.         add(a, b, answer);
  31.         break;
  32.     case (m):
  33.         multiply(a, b, answer);
  34.         break;
  35.     case (d):
  36.         divide(a, b, answer);
  37.         break;
  38.     case (s):
  39.         subtract(a, b, answer);
  40.         break;
  41.     case (p):
  42.         AtoB(a, b, answer);
  43.         break;
  44.     case (r):
  45.         BtoA(a, b, answer);
  46.         break;
  47. }
  48. cout << "\nThese are you operands: " << a << "&: " << b << endl;
  49. cout << "This is the answer to your problems: " << answer << endl;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement