View difference between Paste ID: mmc3yTYJ and 7c5Wt6S9
SHOW: | | - or go back to the newest paste.
1
#include <iostream>
2
#include <math.h>
3
4
using namespace std;
5
    float pole(float x1,float y1,float x2,float y2,float x3,float y3)
6
    {
7
        float ab = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
8
        float ac = sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
9
        float bc = sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
10
        float p = (ab+ac+bc)/2;
11
        return sqrt(p*(p-ab)*(p-ac)*(p-bc));
12
    }
13
14
int main()
15
{
16
    int x1=0,x2=0,x3=0,y1=0,y2=0,y3=0,x=0,y=0;
17
    do{
18
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x>>y;
19
    if((x1==0)&&(x2==0)&&(x3==0)&&(y1==0)&&(y2==0)&&(y3==0)&&(y==0)&&(x==0)){
20
        return 0;
21
    }
22
23
    float all = pole(x1,y1,x2,y2,x3,y3);
24
25
    float abd = pole(x1,y1,x2,y2,x,y);
26
    float bcd = pole(x2,y2,x3,y3,x,y);
27
    float acd = pole(x1,y1,x3,y3,x,y);
28
29
    float sum = abd+bcd+acd;
30
31-
    if(((abd==0)||(bcd==0)||(acd==0))&&(all-sum>=0))
31+
    if(((abd==0)||(bcd==0)||(acd==0))&&(all-sum<=1e-6))
32
    {
33
        cout<<"E"<<endl;
34
    }
35-
    else if(all-sum<0)
35+
    else if(all-sum<=1e-6)
36
    {
37
        cout<<"I"<<endl;
38
    }
39-
    else if(all-sum>0)
39+
40
        cout<<"O"<<endl;
41
    }
42
    
43
44
    }while(true);
45
46
    return 0;
47
}