Guest User

Untitled

a guest
Mar 19th, 2016
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. #define ID_DODAJ    1
  6. #define ID_ODEJMIJ  2
  7. #define ID_POMNOZ   3
  8. #define ID_PODZIEL  4
  9. #define ID_EXIT     5
  10.  
  11. int f_Dodawanie(int a, int b){return a+b;}
  12. int f_Odejmowanie(int a, int b){return a-b;}
  13. int f_Mnozenie(int a, int b){return a*b;}
  14. int f_Dzielenie(int a, int b){return a/b;}
  15. int f_Menu(){
  16.     system("cls");
  17.     cout << "1. +" << endl << "2. -" << endl << "3. *" << endl << "4. /" << endl << "5. exit" << endl;
  18.     int wybor;
  19.     do
  20.     {cin >> wybor;
  21.     }while(wybor < 1 || wybor > 5);
  22.     return wybor;
  23. }
  24.  
  25. int main()
  26. {
  27.     int a, b;
  28.     switch(f_Menu())
  29.     {
  30.         case ID_DODAJ:
  31.             cin >> a >> b;
  32.             cout << f_Dodawanie(a, b) << endl;
  33.             break;
  34.         case ID_ODEJMIJ:
  35.             cin >> a >> b;
  36.             cout << f_Odejmowanie(a, b) << endl;
  37.             break;
  38.         case ID_POMNOZ:
  39.             cin >> a >> b;
  40.             cout << f_Mnozenie(a, b) << endl;
  41.             break;
  42.         case ID_PODZIEL:
  43.             cin >> a >> b;
  44.             cout << f_Dzielenie(a, b) << endl;
  45.             break;
  46.         case ID_EXIT:
  47.             break;
  48.     }
  49.     return 0;
  50. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×