Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int aRe, aIm, bRe, bIm;
  6.  
  7. int additionRe(int aRe, int bRe)
  8. {
  9. return (aRe + bRe);
  10.  
  11. }
  12.  
  13. int additionIm(int aIm, int bIm)
  14. {
  15. return (aIm + bIm);
  16.  
  17. }
  18.  
  19. int main()
  20. {
  21. int operation = 0;
  22.  
  23. do
  24. {
  25. cout << "***************************************\n";
  26. cout << "** COMPLEX NUMBERS TOOL MENU **\n";
  27. cout << "** **\n";
  28. cout << "** 1. Addition **\n";
  29. cout << "** 2. Substraction **\n";
  30. cout << "** 3. Multiplication **\n";
  31. cout << "** 4. Division **\n";
  32. cout << "** **\n";
  33. cout << "** 5. Exit **\n";
  34. cout << "***************************************\n";
  35. cout << "Choose operation from the menu: ";
  36. cin >> operation;
  37. cout << endl;
  38.  
  39.  
  40.  
  41. switch(operation)
  42. {
  43. case 1: cout << "a(Real part) = "; cin >> aRe;
  44. cout << "a(Imaginery part) = "; cin >> aIm;
  45. cout << "b(Real part) = "; cin >> bRe;
  46. cout << "b(Imaginary part = "; cin >> bIm;
  47. system("CLS");
  48. cout << "(" << aRe << "+(" << aIm << "i)) + (" << bRe << "+(" << bIm << "i)= " << additionRe(aRe, bRe) << " " << additionIm(aIm, bIm) << "i" << endl; break;
  49. case 2:;
  50. case 3:;
  51. case 4:;
  52. case 5: ;
  53. default:;
  54. }
  55.  
  56.  
  57.  
  58. } while (operation != 5);
  59.  
  60. system("PAUSE");
  61. return EXIT_SUCCESS;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement