# Can you help me? The problem "Triangle Classification"

my code:

``````#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <iomanip>
#include <list>
#include <deque>
#include <stack>
#define ull unsigned long long
#define ll long long
#define cle(a) memset(a,0,sizeof(a))
const double eps=1e-6;
using namespace std;
struct node{
int x,y;
}nod[4];
bool cmp(int a,int b){
return a>b;
}
int dis(node a,node b){
return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif
//freopen("out.txt","w",stdout);
int t,n,mark;
cin>>t;
cin>>n;
for(int i=1;i<=n;i++){
cin>>nod[1].x>>nod[1].y>>nod[2].x>>nod[2].y>>nod[3].x>>nod[3].y;
int A[3];
A[0]=dis(nod[1],nod[2]);
A[1]=dis(nod[3],nod[2]);
A[2]=dis(nod[1],nod[3]);
sort(A,A+3);
mark=0;
if(A[0]==A[1]||A[1]==A[2])mark=1;
if(t==1){
if(mark)cout<<"Isosceles triangle"<<endl;
else cout<<"Scalene triangle"<<endl;
continue;
}
if(A[2]>A[1]+A[0]){
if(!mark)cout<<"Scalene obtuse triangle"<<endl;
else cout<<"Isosceles obtuse triangle"<<endl;
}
else if(A[2]==A[1]+A[0]){
if(mark)cout<<"Isosceles right triangle"<<endl;
else cout<<"Scalene right triangl"<<endl;
}
else {
if(mark)cout<<"Isosceles acute triangle"<<endl;
else cout<<"Scalene acute triangle"<<endl;
}
}
return 0;
}
``````

I really can not find where is wrong？

1. Define everything as double when dealing with pts / distances 2.Dont use == to compare floating pt values.Read the problem statement.It is given at the end as a note. 3.Your formula to determine angle is wrong.Sum of any 2 sides of a triangle will always be greater than the third. Use cosine formula to find angle.

I tried to remove this: #ifndef ONLINE_JUDGE
freopen(“in.txt”,“r”,stdin);
#endif
and it worked just fine