Write a function printTemp that prints a message describing
Solution
Temp.cpp
#include <iostream>
using namespace std;
void printTemp(float t);
int main()
{
printTemp(22.0);
printTemp(-22.0);
printTemp(64.0);
return 0;
}
void printTemp(float t)
{
if( t <= 0.0){
cout<<\"Freezing\"<<endl;
}
else if(t > 0.0 && t <= 20.0){
cout<<\"Cold\"<<endl;
}
else if(t > 20.0 && t <= 25.0){
cout<<\"Pleasant\"<<endl;
}
else if(t > 25.0 && t <= 32.0){
cout<<\"Warm\"<<endl;
}
else{
cout<<\"Hot\"<<endl;
}
}
Output:
Pleasant
Freezing
Hot
