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; }单项选择题
A
Checking for fever...
B
(Nothing is output)
C
Checking for fever... Your temperature is 2.6 below 95.
D
Checking for fever...Your temperature is 2.6 below 95.
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
Given the following function. To change the function to return the product instead of the sum, how many lines of code need to be changed? int Calculate(int a, int b) { return a + b; } int main() { cout << Calculate(3, 4); cout << Calculate(5, 2); cout << Calculate(6, 7); return 0; }
What is the output of the following program segment? double temp[5]; for (int i = 0; i < 5; i++) temp[i] = pow(i, 2.0) + 3; temp[0] = pow(temp[1], 3); temp[1] = temp[4] - temp[2]; temp[2] = temp[0] - 4; cout << temp[2] << endl;
What is output? #include <iostream> #include <string> #include <sstream> using namespace std; int main() { ostringstream infoOSS; int number; int fact = 1; string infoStr; cout << "Enter a number: " << endl; cin >> number; for(int i = 1; i <= number; i++) { fact = fact * i; infoOSS << i; if(i < number){ infoOSS << '*'; } } infoOSS << " = " << fact; infoStr = infoOSS.str(); cout << "Factorial: " << infoStr << endl; return 0; }
What is output? #include <iostream> #include <string> #include <sstream> using namespace std; int main() { ostringstream infoOSS; int number; int fact = 1; string infoStr; cout << "Enter a number: " << endl; cin >> number; for(int i = 1; i <= number; i++) { fact = fact * i; infoOSS << i; if(i < number){ infoOSS << '*'; } } infoOSS << " = " << fact; infoStr = infoOSS.str(); cout << "Factorial: " << infoStr << endl; return 0; }
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!