Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- float x;
- float y;
- float z;
- cout <<"Adjon meg egy oldalt: ";
- cin >> x;
- cout << "\n";
- cout <<"Adjon meg egy masik oldalt: ";
- cin >> y;
- cout << "\n";
- cout <<"Adjon meg egy ujabb oldalt: ";
- cin >> z;
- cout << "\n";
- /*cout << x;
- cout <<" ";
- cout << y;
- cout <<" ";
- cout << z;
- cout <<"\n";*/
- float a;
- float b;
- float c;
- if(x > y) {a = y; b = x;} else {a = x; b = y;}
- if(z > b) {b = b; c = z;} else {c = b; b = z;}
- /*cout << a;
- cout <<" ";
- cout << b;
- cout <<" ";
- cout << c;
- cout <<"\n";*/
- if( a+b >= c)
- {
- if(c*c == a*a + b*b)
- {
- cout << "\nEzekbol az oldalakbol derekszogu haromszog lesz.\n";
- float ter = (a*b)/2;
- float ma = (a+b+c)/2;
- float beir = 2*ter/(a+b+c);
- float koreir = (a*b*c)/(4*ter);
- cout << "\nA derekszogu haromszog terulete: "<< ter <<"cm^2";
- cout << "\nA derekszogu haromszog magassaga: "<< ma <<"cm";
- cout << "\nA derekszogu haromszog beirhato korenek sugara: "<< beir <<"cm";
- cout << "\nA derekszogu haromszog koreirhato korenek sugara: "<< koreir <<"cm\n\n";
- } else {
- cout << "Ezekbol az oldalakbol lesz haromszog de nem derekszogu.\n\n";
- }
- } else {
- cout <<"\nEzekbol az oldalakbol nem lesz haromszog.\n\n";
- }
- }
- //andras szabolcs
Add Comment
Please, Sign In to add comment