Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication4.cpp: Definiuje punkt wejścia dla aplikacji konsolowej.
- //https://pastebin.com/necibtRB
- #include "stdafx.h"
- #include<iostream>
- #include<string>
- #include<math.h>
- using namespace std;
- class Point {
- public:
- double x;
- double y;
- };
- class Triangle {
- public:
- Point A, B, C;
- double xa = A.x;
- double xb = B.x;
- double xc = C.x;
- double ya = A.y;
- double yb = B.y;
- double yc = C.y;
- double oAB, oBC, oCA;
- public:
- void odleglosci(double &oAB, double &oBC, double &oCA) {
- oAB = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
- oBC = sqrt(pow((xb - xc), 2) + pow((yb - yc), 2));
- oCA = sqrt(pow((xc - xa), 2) + pow((yc - ya), 2));
- fabs(oAB);
- fabs(oBC);
- fabs(oCA);
- }
- private:
- double area() {
- double p = (oAB + oBC + oCA) / 2;
- double poleTri = sqrt(p*(p - oAB)*(p - oBC)*(p - oCA));
- return poleTri;
- }
- double perimiter() {
- double obwod = oAB + oBC + oCA;
- return obwod;
- }
- bool hasGreaterArea() {
- //if () return true;
- }
- };
- class Rectangle {
- public:
- Point A, B, C, D;
- double xa = A.x;
- double xb = B.x;
- double xc = C.x;
- double xd = D.x;
- double ya = A.y;
- double yb = B.y;
- double yc = C.y;
- double yd = D.y;
- double oAB, oBC, oCD, oDA;
- public:
- void odleglosci(double &oAB, double &oBC, double &oCD, double &oDA) {
- oAB = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
- oBC = sqrt(pow((xb - xc), 2) + pow((yb - yc), 2));
- oCD = sqrt(pow((xc - xd), 2) + pow((yc - yd), 2));
- oCD = sqrt(pow((xd - xa), 2) + pow((yd - ya), 2));
- fabs(oAB);
- fabs(oBC);
- fabs(oCD);
- fabs(oDA);
- }
- private:
- double area() {
- double pole = oAB*oBC;
- return pole;
- }
- double perimiter() {
- double obwod = oAB + oBC + oCD+ oDA;
- return obwod;
- }
- bool hasGreaterArea() {
- //if () return true;
- }
- };
- int main()
- {
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement