In: Computer Science
8. write a program using switch-case statements that ask a user to enter a temperature value in degrees Fahrenheit (In your program, use an integer to record the user’s entry. If the temperature falls between 0 and 96 make it print “Temperature below normal”. If the temperature is 97, 98, make it “Temperature normal”. If the temperature is between 100 and 150, print “You have a fever”. If the temperature is outside the ranges given above, display “Are you human”.
Please write in C++
Code
#include<iostream>
using namespace std;
int main()
{
int temp;
cout << "Enter temperature in degrees
Fahrenheit: ";
cin >> temp;
switch (temp)
{
case 0 ... 96:
cout << "Temperature below
normal" << endl;
break;
case 97:
case 98:
cout << "Temperature normal"
<< endl;
break;
case 100 ... 105:
cout << "You have a fever"
<< endl;
break;
default:
cout << "Are you human"
<< endl;
break;
}
return 1;
}
If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.