Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- class trikampis
- {
- private:
- int x1, y1, x2, y2, x3, y3;
- double S;
- public:
- trikampis():x1(0),y1(0),x2(0),y2(0), x3(0), y3(0){}
- trikampis(int a, int b, int c, int d, int e, int f):x1(a),y1(b),x2(c),y2(d),x3(e),y3(f){};
- ~trikampis(){}
- void ived()
- {
- cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
- }
- double plotas()
- {
- double a, b, c, p;
- a =sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
- b =sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
- c =sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
- p = (a+b+c)/2.;
- S = sqrt(p*(p-a)*(p-b)*(p-c));
- }
- double graz_plotas()
- {
- return S;
- }
- };
- int main()
- {
- int n;
- double plot;
- int min = 0;
- cin >> n;
- trikampis *T = new trikampis [n];
- for (int i = 0; i < n; i++) {
- T[i].ived();
- plot = T[i].plotas(); }
- if (plot == 0) cout << "NO";
- else if (plot != 0 && plot < min)
- cout << fixed << setprecision(2) << min;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement