请问:num 在如下程序中是什么功能呢?我从来没有见过这样的程序;
#include <stdio.h>
#include <stdlib.h>
// 此函数判断交点坐标是否在线段坐标范围内,即判断交点是否落在线段上
int between(float u, float v, float w)
{ float max,min;
max=(v>w)?v:w;
min=(v<w)?v:w;
return ((u<=max&&u>=min)?1:0);
}
int main()
{
int n,i,j,num; //n为线段条数
float x1[100],y1[100],x2[100],y2[100],a[100],b[100],c[100],jx,jy;
while(scanf("%d",&n)&&n!=0)
{
num=0;
for(i=0;i<n;++i)
{ scanf("%f%f%f%f",&x1[i],&y1[i],&x2[i],&y2[i]);
if(x1[i]==x2[i])
{
a[i]=1;b[i]=0;c[i]=-x1[i];
}
else
{
a[i]=(y2[i]-y1[i])/(x1[i]-x2[i]);b[i]=1;
c[i]=(x1[i]*y2[i]-x2[i]*y1[i])/(x2[i]-x1[i]);
}
}
for(i=0;i<n;++i)
{
for(j=i+1;j<n;++j)
{
if(a[i]*b[j]-a[j]*b[i]!=0)
{
jx=(b[i]*c[j]-b[j]*c[i])/(a[i]*b[j]-a[j]*b[i]);
jy=(c[i]*a[j]-c[j]*a[i])/(a[i]*b[j]-a[j]*b[i]);
if(between(jx,x1[i],x2[i])&&between(jx,x1[j],x2[j])&&between(jy,y1[i],y2[i])&&between(jy,y1[j],y2[j]))
//printf("(%f,%f)\n ",jx,jy);
num++;
}
}
}
printf("%d\n",num);
}
return 0;
}