csppass
连续 00 XP登录 / 注册
202317判断题数学函数与几何普及/提高

程序(一):交换乘法顺序是否影响结果

题目

阅读下面的程序,回答问题。 #include<iostream> #include<cmath> using namespace std; double f(double a,double b,double c){ double s=(a+b+c)/2; return sqrt(s*(s-a)*(s-b)*(s-c)); } int main(){ cout.flags(ios::fixed); cout.precision(4); int a,b,c; cin>>a>>b>>c; cout<<f(a,b,c)<<endl; return 0; } 判断题:将第7行中的 (s-b)*(s-c) 改为 (s-c)*(s-b) 不会影响程序运行的结果。( 填 √ 或 × )

考点拆解
程序阅读与结果判断
易错提醒
阅读程序题要按变量变化顺序手推,不要跳步
选择题要检查单位、边界和题目中的否定词