| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
那个测试文件结尾怎么结束啊?????#include "stdio.h"
#include "math.h"
#define pi 3.141592653589793
float bian(float x1,float y1, float x2,float y2)
{float c;
c=sqrt((x2-x1)*(x2-x1)+pow((y2-y1),2));
return c;
}
void main()
{float a[100],p,x1,x2,x3,y1,y2,y3,b1=0,b2=0,b3=0,r,cir;
int i=0,j;
char ch;
while(2)
{
scanf("%f%f%f%f%f%f",&x1,&y1,&x2,&y2,&x3,&y3);
b1=bian(x1,y1,x2,y2);
b2=bian(x1,y1,x3,y3);
b3=bian(x3,y3,x2,y2);
p=0.5*(b1+b2+b3);
r=b1*b2*b3/(4*sqrt(p*(p-b1)*(p-b2)*(p-b3)));
cir=2*pi*r;
a[i]=cir;
i++;
if(scanf("%c",&ch)==-1) break;
}
for(j=0;j<i;j++)
printf("%.2f\n",a[j]);
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator