采用C++语言计算三角形的面积
1 #include <stdio.h> 2 #include <math.h> 3 void main() 4 { 5 float a,b,c; 6 double s,area; 7 printf ("please enter three numbers as a b c \n"); 8 scanf ("%f%f%f",&a, &b, &c); 9 s=0.5*(a+b+c); 10 area=sqrt(s*(s-a)*(s-b)*(s-c)); 11 printf ("the area is %f\n", area); 12 }