Advertisement
Guest User

Untitled

a guest
May 24th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.09 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     cout << "Grupa: CN2 \n"<< endl;
  8.     cout<< "Imię i nazwisko: Kacper Bijak\n"<<endl;
  9.     double bok_1, bok_2, bok_3, pole, pol_obwodu;
  10.     cout<<"Podaj bok nr. 1: ";
  11.     cin>>bok_1;
  12.     if(bok_1<=0){
  13.         cout<<"Podales zla wartosc!";
  14.         return -1;
  15.     }
  16.     cout<<"Podaj bok nr. 2: ";
  17.     cin>>bok_2;
  18.     if(bok_2<=0){
  19.         cout<<"Podales zla wartosc!";
  20.         return -1;
  21.     }
  22.     cout<<"Podaj bok nr. 3: ";
  23.     cin>>bok_3;
  24.     if(bok_3<=0){
  25.         cout<<"Podales zla wartosc!";
  26.         return -1;
  27.     }
  28.     if(bok_1+bok_2<=bok_3){
  29.         cout<<"Ten trojkat nie ma prawa zaistniec!";
  30.         return -1;
  31.     }
  32.     if(bok_2+bok_3<=bok_1){
  33.         cout<<"Ten trojkat nie ma prawa zaistniec!";
  34.         return -1;
  35.     }
  36.     if(bok_3+bok_1<=bok_2){
  37.         cout<<"Ten trojkat nie ma prawa zaistniec!";
  38.         return -1;
  39.     }
  40.     pol_obwodu=(bok_1+bok_2+bok_3)/2;
  41.     pole=sqrt(pol_obwodu*(pol_obwodu-bok_1)*(pol_obwodu-bok_2)*(pol_obwodu-bok_3));
  42.     cout<<pole;
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement