01 #include<iostream>
02 #include<cmath>
03 using namespace std;
04
05 double f(double a,double b,double c){
06 double s=(a+b+c)/2;
07 return sqrt(s*(s-a)*(s-b)*(s-c));
08 }
09
10 int main(){
11 cout.flags(ios::fixed);
12 cout.precision(4);
13
14 int a,b,c;
15 cin>>a>>b>>c;
16 cout<<f(a,b,c)<<endl;
17 return 0;
18 }
假设输入的所有数都为不超过1000的正整数,完成下面的判断题和单选题:
当输入为“2 2 2”时,输出为“1.7321”( )
将第7行中的"(s-b)*(s-c)"改为"(s-c)*(s-b)"不会影响程序运行的结果( )
程序总是输出四位小数( )
当输入为“3 4 5”时,输出为( )
"6.0000"
"12.0000"
"24.0000"
"30.0000"
当输入为“5 12 13”时,输出为( )
"24.0000"
"30.0000"
"60.0000"
"120.0000"
发表评论