daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. class rectangle
  5. {
  6. private:
  7.     double a,b;
  8. public:
  9.     rectangle();
  10.     rectangle(double);
  11.     rectangle(double,double);
  12.     void lice();
  13.     void peri();
  14.     void diagonal();
  15.     double output1(double p);
  16.     double output2(double q);
  17. };
  18. rectangle::rectangle()
  19. {
  20.     a=10;
  21.     b=20;
  22. }
  23. rectangle::rectangle(double x)
  24. {
  25.     a=x;
  26.     b=x;
  27. }
  28. rectangle::rectangle(double m,double n)
  29. {
  30.     a=m;
  31.     b=n;
  32. }
  33. void rectangle::lice()
  34. {
  35.     double S;
  36.     S=a*b;
  37.     cout << "S na pravougulnika e -> " << S << endl;
  38. }
  39. void rectangle::peri()
  40. {
  41.     double perimetur;
  42.     perimetur=2*a+2*b;
  43.     cout << "P na pravougulnika e -> " << perimetur << endl;
  44. }
  45. void rectangle::diagonal()
  46. {
  47.     double length;
  48.     length=sqrt(a*a+b*b);
  49.     cout << "Diagonala na pravougulnika e -> " << length << endl;
  50. }
  51. double rectangle::output1(double p)
  52. {
  53.     return p;
  54. }
  55. double rectangle::output2(double q)
  56. {
  57.     return q;
  58. }
  59. int main ()
  60. {
  61.     double str1, str2;
  62.     cout << "Vavedi stranite na pravougalnika -> " << endl;
  63.     cin >> str1 >> str2;
  64.     rectangle first(str1, str2);
  65.     first.lice();
  66.     first.peri();
  67.     first.diagonal();
  68.     cout << first.output1(str1) << endl;
  69.     cout << first.output2(str2) << endl;
  70.     rectangle second(h1,h2);
  71.     rectangle third(z1,z2);
  72.     return 0;
  73. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top