Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. // ConsoleApplication4.cpp: Definiuje punkt wejścia dla aplikacji konsolowej.
  2. //https://pastebin.com/necibtRB
  3.  
  4. #include "stdafx.h"
  5. #include<iostream>
  6. #include<string>
  7. #include<math.h>
  8. using namespace std;
  9.  
  10. class Point {
  11. public:
  12. double x;
  13. double y;
  14. };
  15.  
  16. class Triangle {
  17. public:
  18. Point A, B, C;
  19. double xa = A.x;
  20. double xb = B.x;
  21. double xc = C.x;
  22. double ya = A.y;
  23. double yb = B.y;
  24. double yc = C.y;
  25. double oAB, oBC, oCA;
  26.  
  27. public:
  28. void odleglosci(double &oAB, double &oBC, double &oCA) {
  29. oAB = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
  30. oBC = sqrt(pow((xb - xc), 2) + pow((yb - yc), 2));
  31. oCA = sqrt(pow((xc - xa), 2) + pow((yc - ya), 2));
  32. fabs(oAB);
  33. fabs(oBC);
  34. fabs(oCA);
  35. }
  36.  
  37.  
  38. private:
  39. double area() {
  40. double p = (oAB + oBC + oCA) / 2;
  41. double poleTri = sqrt(p*(p - oAB)*(p - oBC)*(p - oCA));
  42. return poleTri;
  43.  
  44. }
  45. double perimiter() {
  46. double obwod = oAB + oBC + oCA;
  47. return obwod;
  48. }
  49. bool hasGreaterArea() {
  50. //if () return true;
  51.  
  52. }
  53.  
  54. };
  55.  
  56. class Rectangle {
  57. public:
  58. Point A, B, C, D;
  59. double xa = A.x;
  60. double xb = B.x;
  61. double xc = C.x;
  62. double xd = D.x;
  63. double ya = A.y;
  64. double yb = B.y;
  65. double yc = C.y;
  66. double yd = D.y;
  67. double oAB, oBC, oCD, oDA;
  68.  
  69. public:
  70. void odleglosci(double &oAB, double &oBC, double &oCD, double &oDA) {
  71. oAB = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
  72. oBC = sqrt(pow((xb - xc), 2) + pow((yb - yc), 2));
  73. oCD = sqrt(pow((xc - xd), 2) + pow((yc - yd), 2));
  74. oCD = sqrt(pow((xd - xa), 2) + pow((yd - ya), 2));
  75. fabs(oAB);
  76. fabs(oBC);
  77. fabs(oCD);
  78. fabs(oDA);
  79. }
  80.  
  81. private:
  82. double area() {
  83. double pole = oAB*oBC;
  84. return pole;
  85.  
  86. }
  87. double perimiter() {
  88. double obwod = oAB + oBC + oCD+ oDA;
  89. return obwod;
  90. }
  91. bool hasGreaterArea() {
  92. //if () return true;
  93.  
  94. }
  95.  
  96.  
  97. };
  98.  
  99. int main()
  100. {
  101.  
  102. system("PAUSE");
  103. return 0;
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement