Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- cout << "Grupa: CN2 \n"<< endl;
- cout<< "Imie i nazwisko: Kacper Bijak\n"<<endl;
- double bok_1, bok_2, bok_3, pole, pol_obwodu;
- cout<<"Podaj bok nr. 1: ";
- cin>>bok_1;
- if(bok_1<=0){
- cout<<"Podales zla wartosc!";
- return -1;
- }
- cout<<"Podaj bok nr. 2: ";
- cin>>bok_2;
- if(bok_2<=0){
- cout<<"Podales zla wartosc!";
- return -1;
- }
- cout<<"Podaj bok nr. 3: ";
- cin>>bok_3;
- if(bok_3<=0){
- cout<<"Podales zla wartosc!";
- return -1;
- }
- if(bok_1+bok_2<=bok_3){
- cout<<"Ten trojkat nie ma prawa zaistniec!";
- return -1;
- }
- if(bok_2+bok_3<=bok_1){
- cout<<"Ten trojkat nie ma prawa zaistniec!";
- return -1;
- }
- if(bok_3+bok_1<=bok_2){
- cout<<"Ten trojkat nie ma prawa zaistniec!";
- return -1;
- }
- pol_obwodu=(bok_1+bok_2+bok_3)/2;
- pole=sqrt(pol_obwodu*(pol_obwodu-bok_1)*(pol_obwodu-bok_2)*(pol_obwodu-bok_3));
- cout<<"Pole = "<<pole;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement