Creative Commons License Foxbond's Repo

/** (c) 2012 Michał (Foxbond) Chraniuk */
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
    int a,b,c,d;
    bool w = false;
    cout << "Podaj dlugosci ramion trojkata"<<endl;
    cin >> a >> b >> c;
    if ( (a<(b+c)) && (b<(a+c)) && (c<(b+a)) ) {w=true;}  
    if (w) { cout<<"Trojkat istnieje!"<<endl; }else {
       cout<<"Trojkat nie istnieje! Nie sprawdzam czy jest prostokatny!"<<endl;
       system("Pause"); return 1;}
    if (a>b){if(a>c){d=(b*b)+(c*c)-(a*a);}else{ d=(b*b)+(a*a)-(c*c); }}else {if (b>c){ d=(a*a)+(c*c)-(b*b);} else {d=(b*b)+(a*a)-(c*c); }}
    if (d==0) { cout << "\nTrojkat jest prostokatny"<<endl; }
    else { cout << "\nTrojkat nie jest prostokatny"<<endl; }
    system("Pause"); return 1; }

> Back