Advertisement
Lukasz_Miskiewicz

Zadanie 6 Poprawione

Mar 31st, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. float a,b;
  4.  
  5. float iloraz(float a, float b)
  6. {if(a>0 && b>0)
  7. {return a/b;}
  8. else
  9. if (b==0)
  10. {return -1;}
  11. else
  12. {return -2;};
  13. }
  14.  
  15. int main()
  16. {
  17. cout<<"podaj liczby do podzielenia"<<endl;
  18. cin>>a;
  19. cin>>b;
  20. if(iloraz(a,b)==-1)
  21. {cout<<"nie dziel przez zero";}
  22. else
  23. if (iloraz(a,b)==-2)
  24. {cout<<"nie dziel przez zero";}
  25. else
  26. {cout<<"iloraz wynosi "<<iloraz(a,b);}
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement