I'm quite a novice at problem solving. (I'm more into game programming

) I recently entered this weird world and have started losing hair

. I presume from the forrum that the problem with this problem is the precission. I know zilch about precission

. Can someone tell me why I get a WA. Here's my code. The logic is plain geometry...
Oh, and something about precission would be just fabulous, babe
[cpp]
#include "stdio.h"
#include "io.h"//"io.h" for open() close() in VC++.NET2K3
#include "fcntl.h"
inline int IsIn(float x1, float y1, float x2, float y2, float x3, float y3, float x, float y);
inline void Init(void);
float fCo[3][2];
float fMaxx,fMinx,fMaxy,fMiny,fiInit,fjInit,fiTerm,fjTerm;
int main(void)
{
#ifndef ONLINE_JUDGE //I remove this part before submitting. I
// also remove io.h && fcntl.h
close(0);open("in.txt",O_RDONLY);
close(1);open("out.txt",O_WRONLY|O_CREAT,0600);
#endif
for(int p=0;p<3;p++)//I like to init everything
{
fCo[p][0]=0;
fCo[p][1]=0;
}
fMaxx=0;
fMaxy=0;
fMinx=0;
fMiny=0;
scanf("%f%f%f%f%f%f",&fCo[0][0],&fCo[0][1],
&fCo[1] [0],&fCo[1][1],&fCo[2][0],&fCo[2][1]);
while(fCo[0][0]||fCo[0][1]||
fCo[1][0]||fCo[1][1]||
fCo[2][0]||fCo[2][1])
{
Init();
int iCount=0;
for(float i=fiInit;i<fiTerm;i++)
for(float j=fjInit;j<fjTerm;j++)
{
if(IsIn(fCo[0][0],fCo[0][1],fCo[1][0],
fCo[1][1],fCo[2][0],fCo[2][1],i,j))
if(IsIn(fCo[1][0],fCo[1][1],fCo[2][0],
fCo[2][1],fCo[0][0],fCo[0][1],i,j))
if(IsIn(fCo[2][0],fCo[2][1],fCo[0][0],
fCo[0][1],fCo[1][0],fCo[1][1],i,j))
iCount++;
}
printf("%4d\n",iCount);
scanf("%f%f%f%f%f%f",&fCo[0][0],&fCo[0][1],
&fCo[1][0],&fCo[1][1],&fCo[2][0],&fCo[2][1]);
}
return 0;
}
//Main() Done.
///////////////////////
///////////////////////
//IsIn()
inline int IsIn(float x1, float y1, float x2, float y2, float x3, float y3, float x, float y)
{
float l=((y1-y2)*(x3-x1))-((x1-x2)*(y3-y1));//Geometry...
float m=((y1-y2)*(x-x1))-((x1-x2)*(y-y1));//Same here...
//Next bit is to see if all four points are on the same line...
//My prog ran less than one second when I didn't consider this!
if(l==0)
{
if(m==0)//(i,j) on that line
{
if((x>=fMinx)&&(x<=fMaxx)&&
(y>=fMiny)&&(y<=fMaxy))
return 1;
else return 0;
}
else return 0;
}
//Next to check if 3 points are not on the same line and
//that (i,j) is on the same side as the 3rd point of the line
//joining first 2 points or if (i,j) is on that line.
if((l>0&&m>0)||(l<0&&m<0)||(m==0))//m==0... if error goes
//through once or even twice
//It'll get caught
// the third time
return 1;
else
return 0;
}//IsIn() Done
/////////////
////////////
//Init()
inline void Init(void)
{
fMaxx=fCo[0][0];
fMinx=fCo[0][0];
fMaxy=fCo[0][1];
fMiny=fCo[0][1];
for(int i=0;i<3;i++)//Find Min and Max x and y
{
if(fCo
[0]>=fMaxx)
fMaxx=fCo[0];
if(fCo[0]<=fMinx)
fMinx=fCo[0];
if(fCo[1]>=fMaxy)
fMaxy=fCo[1];
if(fCo[1]<=fMiny)
fMiny=fCo[1];
}
//I'm doing this bit to reduce the number of cycles.
//I ran into Time Over when I didn't.
if(fMinx==0)
fiInit=1;//No trees on x and y axes
else
fiInit=(float)((int)fMinx);//Doublecast(!) to avoid
//the pesky warning...
if(fMiny==0)
fjInit=1;
else
fjInit=(float)((int)fMiny);
if(fMaxx==100)//No trees on x=100 and y=100
fiTerm=100;
else
fiTerm=(float)((int)(fMaxx+1));
if(fMaxy==100)
fjTerm=100;
else
fjTerm=(float)((int)(fMaxy+1));
}[/cpp]