#include <stdio.h> #include <math.h> int main() { double a,b,c; int wbx=1; while(scanf("%lf %lf %lf",&a,&b,&c)!=EOF) { if(a==0 &&b==0 &&c==0) { break; } if(c==-1) { if(wbx) { printf("Triangle #%d\n",wbx); printf("c = %.3lf\n\n",sqrt(a*a+b*b)); wbx++; } } if((b==-1 &&c<=a) || (a==-1 &&c<=b) ) { if(wbx) { printf("Triangle #%d\n",wbx); printf("Impossible.\n\n"); wbx++; } } if(b==-1 &&c>a) { if(wbx) { printf("Triangle #%d\n",wbx); printf("b = %.3lf\n\n",sqrt(c*c-a*a)); wbx++; } } if(a==-1 &&c>b) { if(wbx) { printf("Triangle #%d\n",wbx); printf("a = %.3lf\n\n",sqrt(c*c-b*b)); wbx++; } } } return 0; }
原文地址:http://blog.csdn.net/sky_miange/article/details/41747751