Advertisement
pVinc

kalk.cpp

Jun 2nd, 2020
167
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<cstdio>
  3.  
  4. using namespace std;
  5.  
  6. float suma(float a,float b){
  7.    
  8.     float temp;
  9.     temp=a+b;
  10.     return temp;
  11. }
  12. float roznica(float a,float b){  
  13.     float temp;
  14.     temp=a-b;
  15.     return temp;
  16. }
  17. float iloczyn(float a ,float b){
  18.     float temp;
  19.     temp=a*b;
  20.     return temp;
  21. }
  22.  
  23.  
  24. float iloraz (float a,float b){
  25.     if(b==0){
  26.         cout << "Blad dzielenia" << endl;
  27.         return 0;
  28.     }else{
  29.         return a/b;
  30.     }
  31. }
  32.  
  33. int main(){
  34.     float a,b,s=0,r=0,il=0,ilor=0;
  35.     cout<<"Podaj wartosc a: ";
  36.     cin>>a;
  37.     cout<<"Podaj wartosc b: ";
  38.     cin>>b;
  39.     s=suma(a,b);
  40.     r=roznica(a,b);
  41.     il=iloczyn(a,b);
  42.     ilor=iloraz(a,b);
  43.     cout<<"suma wynosi: "<<s<<endl;
  44.     cout<<"Roznica wynosi: "<<r<<endl;
  45.     cout<<"Iloczyn wynosi: "<<il<<endl;
  46.     cout<<"Iloraz wynosi: "<<ilor<<endl;
  47.    
  48.         getchar();
  49.         return 0;
  50. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement