Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. class PRISM
  8. {
  9. public:
  10.     float a;
  11.     float b;
  12.     float c;
  13.     float d;
  14.  
  15.     void przypisz()
  16.     {
  17.         cout << "podaj a" << endl;
  18.         cin >> a;
  19.         cout << "podaj b" << endl;
  20.         cin >> b;
  21.         cout << "podaj c" << endl;
  22.         cin >> c;
  23.     }
  24.  
  25.     void oblicz()
  26.     {
  27.         d = sqrt(a*a + b*b + c*c);
  28.         cout << "przekatna wynosi" << endl;
  29.         cout << d << endl;
  30.     }
  31.  
  32.     void wypisz()
  33.     {
  34.         // ", " <<
  35.         if (a>b)
  36.         {
  37.             if (a>c)
  38.             {
  39.                 if (b>c)
  40.                 {
  41.                     cout << "Dlugosci bokow bryly " << "c= " << c << ", " << "b= " << b << ", " << "a= " << a << endl;
  42.                 }
  43.  
  44.                 else
  45.                 {
  46.                     cout << "Dlugosci bokow bryly" << "b= " << b << ", " << "c= " << c <<", " << "a= " << a << endl;
  47.                 }
  48.             }
  49.  
  50.             else
  51.             {
  52.                 cout << "Dlugosci bokow bryly " << "b= " << b << ", " << "a= " << a << ", " << "c= " << c << endl;
  53.             }
  54.  
  55.         }
  56.  
  57.         else
  58.         {
  59.             if (b>c)
  60.             {
  61.                 if (a>c)
  62.                 {
  63.                     cout << "Dlugosci bokow bryly " << "c= " << c << ", " << "a= " << a << ", " << "b= " << b << endl;
  64.                 }
  65.  
  66.                 else
  67.                 {
  68.                     cout << "Dlugosci bokow bryly " << "a= " << a << ", " << "c= " << c << ", " << "b= " << b << endl;
  69.                 }
  70.             }
  71.             else
  72.             {
  73.                 cout << "Dlugosci bokow bryly " << "a= " << a << ", " << "b= " << b << ", " << "c= " << c << endl;
  74.             }
  75.  
  76.         }
  77.     }
  78.  
  79. };
  80.  
  81. int main()
  82. {
  83.     PRISM PR;
  84.     PR.przypisz();
  85.     PR.oblicz();
  86.     PR.wypisz();
  87.  
  88.     system("pause");
  89.  
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement