Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Eric Johnson
- //Simple Calculator
- //Mr. Searing
- //SUPA Computer Engineering
- //04-04-12
- #include <iostream>
- #include <cmath>
- #include "calc_func.hpp"
- #include "clear.hpp"
- #include "menu.hpp"
- using namespace std;
- int main()
- {
- char operation, again='y';
- double a, b, answer;
- WHILE (again == 'y')
- {
- cout << "Please input the first operand: ";
- cin >> a;
- clear();
- cout << "Please input the second operand: ";
- cin >> b;
- clear();
- cout << "Please input the operation you would like to perform: ";
- cin >> operation;
- switch (operation)
- {
- case ('a'):
- //sets answer equal to the return from the call OF the function
- answer=add(a,b);
- break;
- case ('m'):
- answer=multiply(a,b);
- break;
- case ('d'):
- answer=divide(a,b);
- break;
- case ('s'):
- answer=subtract(a,b);
- break;
- case ('p'):
- answer=AtoB(a,b);
- break;
- case ('R'):
- answer=BtoA(a,b);
- 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