Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- using namespace std;
- void main() {
- setlocale(LC_ALL, "Russian");
- double circle_y = 3.0;
- double circle_x = -7.0;
- double circle_r = 3.0;
- double triangle_v1_x = 0.0;
- double triangle_v1_y = 0.0;
- double triangle_v2_x = -5.0;
- double triangle_v2_y = 0.0;
- double triangle_v3_x = 0.0;
- double triangle_v3_y = 6.0;
- double point_x;
- double point_y;
- double s,s1,s2,s3;
- cout<<"Введите X: ";
- cin>>point_x;
- cout<<endl;
- cout<<"Введите Y: ";
- cin>>point_y;
- cout<<endl;
- s = 0.5*fabs((triangle_v1_x - triangle_v3_x)*(triangle_v2_y - triangle_v3_y) - (triangle_v2_x - triangle_v3_x)*(triangle_v1_y - triangle_v3_y));
- s1 = 0.5*fabs((point_x - triangle_v3_x)*(triangle_v2_y - triangle_v3_y) - (triangle_v2_x - triangle_v3_x)*(point_y - triangle_v3_y));
- s2 = 0.5*fabs((triangle_v1_x - triangle_v3_x)*(point_y - triangle_v3_y) - (point_x - triangle_v3_x)*(triangle_v1_y - triangle_v3_y));
- s3 = 0.5*fabs((triangle_v1_x - point_x)*(triangle_v2_y - point_y) - (triangle_v2_x - point_x)*(triangle_v1_y - point_y));
- if(s == (s1+s2+s3) || (pow((point_y - circle_y), 2.0) + pow((point_x - circle_x), 2.0)) <= pow(circle_r, 2.0))cout<<"Принадлежит"<<endl;else cout<<"Не принадлежит"<<endl;
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement