Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int aRe, aIm, bRe, bIm;
- int additionRe(int aRe, int bRe)
- {
- return (aRe + bRe);
- }
- int additionIm(int aIm, int bIm)
- {
- return (aIm + bIm);
- }
- int main()
- {
- int operation = 0;
- do
- {
- cout << "***************************************\n";
- cout << "** COMPLEX NUMBERS TOOL MENU **\n";
- cout << "** **\n";
- cout << "** 1. Addition **\n";
- cout << "** 2. Substraction **\n";
- cout << "** 3. Multiplication **\n";
- cout << "** 4. Division **\n";
- cout << "** **\n";
- cout << "** 5. Exit **\n";
- cout << "***************************************\n";
- cout << "Choose operation from the menu: ";
- cin >> operation;
- cout << endl;
- switch(operation)
- {
- case 1: cout << "a(Real part) = "; cin >> aRe;
- cout << "a(Imaginery part) = "; cin >> aIm;
- cout << "b(Real part) = "; cin >> bRe;
- cout << "b(Imaginary part = "; cin >> bIm;
- system("CLS");
- cout << "(" << aRe << "+(" << aIm << "i)) + (" << bRe << "+(" << bIm << "i)= " << additionRe(aRe, bRe) << " " << additionIm(aIm, bIm) << "i" << endl; break;
- case 2:;
- case 3:;
- case 4:;
- case 5: ;
- default:;
- }
- } while (operation != 5);
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement