Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- float OBWOD_TROJKATA(float a, float b, float c)
- {
- if(a<b+c && b<c+a && c<b+a)
- {
- return a+b+c;
- }
- else
- {
- return -1;
- }
- }
- int main()
- {
- float a = OBWOD_TROJKATA(3, 4, 5);
- if (a==-1)
- {
- cout << "Nie da sie utworzyc trojkata" << endl;
- }
- else
- {
- cout << a << endl;
- }
- float b = OBWOD_TROJKATA(0, 0, 0);
- if (b==-1)
- {
- cout << "Nie da sie utworzyc trojkata" << endl;
- }
- else
- {
- cout << b << endl;
- }
- float c = OBWOD_TROJKATA(-3, -4, -5);
- if (c==-1)
- {
- cout << "Nie da sie utworzyc trojkata" << endl;
- }
- else
- {
- cout << c << endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment