Advertisement
PatrickSwayze

zad 1 roz 11

Jan 17th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. float a,b;
  5. namespace operacje
  6. {
  7.     int dodaj(float a,float b)
  8.     {
  9.         return (a+b);
  10.     }
  11.     int odejmij(float a,float b)
  12.     {
  13.         return (a-b);
  14.     }
  15.     int pomnoz(float a,float b)
  16.     {
  17.         return (a*b);
  18.     }
  19.     int podziel(float a,float b)
  20.     {
  21.         return (a/b);
  22.     }
  23.     int reszta(int a,int b)
  24.     {
  25.         return (a%b);
  26.     }
  27. }
  28. void pobierz()
  29. {
  30.       cout<<"Podaj a i b"<<endl;
  31.       cin>>a;
  32.       cin>>b;
  33. }
  34. using namespace operacje;
  35. void dzialania()
  36. {
  37.     cout<<"Dodawanie ";
  38.     cout<<dodaj(a,b)<<endl;
  39.     cout<<"Odejmowanie ";
  40.     cout<<odejmij(a,b)<<endl;
  41.     cout<<"Mnozenie ";
  42.     cout<<pomnoz(a,b)<<endl;
  43.     cout<<"Dzielenie calkowite ";
  44.     cout<<podziel(a,b)<<endl;
  45.     cout<<"Reszta z dzielenia ";
  46.     cout<<reszta(a,b)<<endl;
  47. }
  48.  
  49. int main()
  50. {
  51.     pobierz();
  52.     dzialania();
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement