От: | kov_serg | ||
Дата: | 27.01.19 14:55 | ||
Оценка: |
#include <math.h>
struct tetrahedron {
double a,b,c,ea,eb,ec;
double volume() const {
double A=a*a, B=b*b, C=c*c, X=B+C-ea*ea, Y=A+C-eb*eb, Z=A+B-ec*ec;
return sqrt(4*A*B*C-A*X*X-B*Y*Y-C*Z*Z+X*Y*Z)/12;
}
};
#include <stdio.h>
int main(int argc,char** argv) {
tetrahedron t;
t.a=1; t.b=1; t.c=1;
t.ea=1; t.eb=1; t.ec=1;
double V=t.volume(), V0=sqrt(2)/12;
printf("V=%.5f (%.5f)\n",V,V0);
return 0;
}