What is output? double MyFct(double a, double b) { return (a + b) / 2.0; } int main() { double x = 3.0; double y = 5.0; double z = 8.0; double t; t = MyFct(x, y); t = MyFct(t, z); cout << t << endl; return 0; }单项选择题
A
6.0
B
4.0
C
16.0
D
8.0
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
What is the output of the following program lines when embedded in a correct program that declares all variables to be of type char? a = ‘c’; b = a; c = ‘a’; cout << a << ‘b’ << c;
What is the output? double CheckForFever (double temperature) { const double NORMAL_TEMP = 98.6; const double CUTOFF_TEMP = 95; double degreesOfFever; if (temperature > NORMAL_TEMP) { degreesOfFever = temperature - NORMAL_TEMP; cout << "You have " << degreesOfFever << " degrees of fever."; } else if (temperature < CUTOFF_TEMP) { degreesOfFever = CUTOFF_TEMP - temperature; cout << "Your temperature is " << degreesOfFever << " below 95."; } return degreesOfFever; } int main() { double bodyTemperature; double degreesOfFever; bodyTemperature = 96.0; cout << "Checking for fever..."; degreesOfFever = CheckForFever(bodyTemperature); return 0; }
What is the output? #include <iostream> using namespace std; const double LB_PER_KG = 2.2; double KgsToLbs(double kilograms) { double pounds; pounds = kilograms * LB_PER_KG; return pounds; } int main() { double pounds; pounds = KgsToLbs(10); cout << pounds; return 0; }
Consider these functions: double f(double x) { return g(x) + sqrt(h(x)); } double g(double x) { return 4 * h(x); } double h(double x) { return x * x + k(x) - 1; } double k(double x) { return 2 * (x + 1); } Determine the results of the following function call: double value = g(h(2)); cout << value << endl;
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!