Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- float ILORAZ(float a, float b);
- int main(){
- cout << "wprowadz 2 liczby" << endl;
- int a, b;
- cin >> a >> b;
- if (ILORAZ(a,b) == -1) cout << "Nie dziel przez 0" << endl;
- else if (ILORAZ(a, b) == -2) cout << "Nie wprowadzaj liczb ujemnych" << endl;
- else cout << "wynik to: " << ILORAZ(a,b) << endl;
- }
- float ILORAZ(float a, float b){
- if (b == 0) return -1;
- else if (a < 0 || b < 0) return -2;
- else return a/b;
- }
Advertisement
Add Comment
Please, Sign In to add comment