Create a program that checks for normal body temperature. The program will ask the patient to provide their temperature in Fahrenheit. The normal body temperature ranges from 97 to 99℉. Inform the user that their temperature is normal or ask them to see a doctor depending on the results. Which variation of the if statement would best fit the requirements (if, if-else, if-else-if chain, nested if)? You don't need to create the entire program. You only need to create the conditional statement. #include #include int main() { double temperature = 97; std::cout << "Please enter your temperature in Fahrenheit: "; std::cin >> temperature; // provide code here return 0; }
#include<iostream> #include <iomanip> int main() { double temperature = 97; std::cout << "Please enter your temperature in Fahrenheit: "; std::cin >> temperature; if (temperature >= 97 && temperature <= 99) { std::cout << "Your temperature is normal" << std::endl; } else { std::cout << "see a doctor" << std::endl; } return 0; } // Answer: Standard if-else statement is the most appropriate here
Get Answers For Free
Most questions answered within 1 hours.