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 luocean at 2008-11-05 16:36:54 on Problem 1329
#include "math.h"
# include"stdio.h"
void o(double a)
{
	if(a<0)  printf("- %.3f",-a);
	else printf("+ %.3f",a);
}
void oo( char * a)
{
	printf("%s",a);
}
void out(double * a)
{
	double d[3];
	double  x,y,z;
	double  e,f,g;
	int i=0;
	for(i=0;i<3;i++)
	{
        d[i]=a[i*2]*a[i*2]+a[i*2+1]*a[i*2+1];
	}
	y=( (d[0]-d[1])*(a[0]-a[4])-(d[0]-d[2])*(a[0]-a[2]) )/( (a[1]-a[5])*(a[0]-a[2])-(a[1]-a[3])*(a[0]-a[4]));
x=(d[1]-d[0]+y*(a[3]-a[1]))/(a[0]-a[2]);
z=-1*(d[0]+x*a[0]+y*a[1]);
e=x/2;
f=y/2;
g=sqrt(e*e+f*f-z);
oo("(x "),o(e),oo(")^2 + (y "),o(f),oo(")^2 = "),printf("%.3f",g),oo("^2\n");
oo("x^2 + y^2 ");
o(x),oo("x "),o(y),oo("y "),o(z),oo(" = 0\n\n");
}
int main()
{
	double a[6];
	int i=0;
	int n=0;
	while(scanf("%lf",&a[0])==1)
	{ 
		   i=1;
          while(1)
		  {
			  if(i==6) break;
			  while(scanf("%lf",&a[i])!=1 );
			  i++;
		  }
	out(a);
	}
		return 0;
}

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