2-Masalaning qo’yilishi:
#include
#include
using namespace std;
float s3(float x1, float y1, float x2, float y2, float x3, float y3){
return abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
}
int main()
{
float x1,x2,x3,x,y1,y2,y3,y;
cout<<"x="; cin>>x;
cout<<"x1="; cin>>x1;
cout<<"x2="; cin>>x2;
cout<<"x3="; cin>>x3;
cout<<"y="; cin>>y;
cout<<"y1="; cin>>y1;
cout<<"y2="; cin>>y2;
cout<<"y3="; cin>>y3;
bool dotIsIn = s3(x1,y1,x2,y2,x3,y3) == s3(x,y,x1,y1,x2,y2) + s3(x,y,x1,y1,x3,y3) + s3(x,y,x2,y2,x3,y3);
cout << (dotIsIn ? "Ichkarida" : "Tashqarida");
}
Do'stlaringiz bilan baham: |