You are on page 1of 1

Zadanie 12

#include <iostream>

#include <cmath>

using namespace std;

float a, b, c, p, pole;

string koniec;

int main()

do{

cout << "Podaj a" << endl;

cin >> a;

cout << "Podaj b" << endl;

cin >> b;

cout << "Podaj c" << endl;

cin >> c;

if(a>0&&b>0&&c>0&&a+b>c&&a+c>b&&b+c>a)

p = (a+b+c)/2;

pole = sqrt(p*(p-a)*(p-b)*(p-c));

cout << "Trojkat istnieje, a jego pole wynosi " << pole << endl;

else

cout << "Trojkat nie istnieje" << endl;

cout << "konczymy na dzis? t-tak" << endl;

cout << "Inny przycisk powoduje ponowne uruchomienie programu" << endl;

cin >> koniec;

}while(koniec!="t");

return 0;

You might also like