Guest User

Untitled

a guest
Apr 26th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.75 KB | None | 0 0
  1.     #include <iostream>
  2.     #include <cmath>
  3.  
  4.     using namespace std;
  5.  
  6.     int main()
  7.     {
  8.         float x;
  9.         float y;
  10.         float z;
  11.  
  12.         cout <<"Adjon meg egy oldalt: ";
  13.         cin >> x;
  14.         cout << "\n";
  15.         cout <<"Adjon meg egy masik oldalt: ";
  16.         cin >> y;
  17.         cout << "\n";
  18.         cout <<"Adjon meg egy ujabb oldalt: ";
  19.         cin >> z;
  20.         cout << "\n";
  21.  
  22.         /*cout << x;
  23.         cout <<" ";
  24.         cout << y;
  25.         cout <<" ";
  26.         cout << z;
  27.         cout <<"\n";*/
  28.  
  29.         float a;
  30.         float b;
  31.         float c;
  32.  
  33.         if(x > y) {a = y; b = x;} else {a = x; b = y;}
  34.         if(z > b) {b = b; c = z;} else {c = b; b = z;}
  35.  
  36.         /*cout << a;
  37.         cout <<" ";
  38.         cout << b;
  39.         cout <<" ";
  40.         cout << c;
  41.         cout <<"\n";*/
  42.  
  43.         if( a+b >= c)
  44.         {
  45.             if(c*c == a*a + b*b)
  46.             {
  47.                 cout << "\nEzekbol az oldalakbol derekszogu haromszog lesz.\n";
  48.                 float ter = (a*b)/2;
  49.                 float ma = (a+b+c)/2;
  50.                 float beir = 2*ter/(a+b+c);
  51.                 float koreir = (a*b*c)/(4*ter);
  52.                 cout << "\nA derekszogu haromszog terulete: "<< ter <<"cm^2";
  53.                 cout << "\nA derekszogu haromszog magassaga: "<< ma <<"cm";
  54.                 cout << "\nA derekszogu haromszog beirhato korenek sugara: "<< beir <<"cm";
  55.                 cout << "\nA derekszogu haromszog koreirhato korenek sugara: "<< koreir <<"cm\n\n";
  56.             } else {
  57.                 cout << "Ezekbol az oldalakbol lesz haromszog de nem derekszogu.\n\n";
  58.             }
  59.  
  60.         } else {
  61.             cout <<"\nEzekbol az oldalakbol nem lesz haromszog.\n\n";
  62.         }
  63.  
  64.  
  65.     }
  66.  
  67.  
  68. //andras szabolcs
Add Comment
Please, Sign In to add comment