Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- // Using nsp std to avoid using std:: prefix!
- using namespace std;
- // SUB-PROGRAMS
- void add();
- void subtraction();
- void multiplication();
- void division();
- // GLOBAL VARIABLES
- int oper;
- long num1;
- long num2;
- // MAIN PROGRAM
- int main()
- {
- cout << "choose from the underneath nums to do a math operation:";
- cout << "1 for add";
- cout << "2 for sub";
- cout << "3 for mult";
- cout << "4 for div";
- cin >> oper;
- switch(oper)
- {
- case 1:
- add();
- break;
- case 2:
- subtraction();
- break;
- case 3:
- multiplication();
- break;
- case 4:
- division();
- break;
- default:
- exit;
- break;
- }
- system("pause");
- return 0;
- }
- void add()
- {
- cout << "grapse enan ari8mo";
- cin >> num1;
- cout << "grapse enan allon ari8mo";
- cin >> num2;
- cout << "to a8roisma tous kanei : " << num1 + num2;
- }
- void subtraction()
- {
- cout << "grapse enan ari8mo";
- cin >> num1;
- cout << "grapse enan allon ari8mo";
- cin >> num2;
- cout << "h diafora tous kanei : " << num1 - num2;
- }
- void multiplication()
- {
- cout << "grapse enan ari8mo";
- cin >> num1;
- cout << "grapse enan allon ari8mo";
- cin >> num2;
- cout << "o pollaplasiasmos tous kanei : " << num1 * num2;
- }
- void division()
- {
- cout << "grapse enan ari8mo";
- cin >> num1;
- cout << "grapse enan allon ari8mo";
- cin >> num2;
- cout << "h diairesh tous kanei : " << num1 / num2;
- }
Advertisement
Add Comment
Please, Sign In to add comment