Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

那个测试文件结尾怎么结束啊?????

Posted by wcp at 2005-05-14 16:10:44
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator