Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Calculator

By: EricJohnson on Mar 29th, 2012  |  syntax: C++  |  size: 0.86 KB  |  views: 42  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }