Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Eric Johnson
- //Simple Calculator
- //03-27-12
- #include <iostream>
- #include <math>
- #include "calc_func.hpp"
- #include "clear.hpp"
- using namespace std;
- int main()
- {
- char operation;
- double a, b, answer;
- cout << "Please input the first operand: ";
- cin >> a;
- clear();
- cout << "Please input the second operand: ";
- cin >> b;
- clear();
- int lookup[]=
- {
- (operation = "a"),(operation = "m"),(operation = "d"),(operation = "s"),
- (operation = "p"),(operation = "r"),
- };
- cout << "Please choose the operation you would like to perform: " << endl;
- cin >> operation ;
- switch (lookup)
- {
- case (a):
- add(a, b, answer);
- break;
- case (m):
- multiply(a, b, answer);
- break;
- case (d):
- divide(a, b, answer);
- break;
- case (s):
- subtract(a, b, answer);
- break;
- case (p):
- AtoB(a, b, answer);
- break;
- case (r):
- BtoA(a, b, answer);
- break;
- }
- cout << "\nThese are you operands: " << a << "&: " << b << endl;
- cout << "This is the answer to your problems: " << answer << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement