Temperature Program , Enter values to print following Statements
1. Less than zero print Cold
2. between 1 - 20 print normal
3. between 21 to 30 print moderate
4. between 31 to 40 print hot
5. greater than 40 print very hot
#include <iostream>
int main()
{
int temp;
std::cout<<"Menu\nWeather Program\n";
std::cout<<"Please enter temperature value between -n to +n \n";
std::cin>>temp;
if(temp<1)
std::cout<<"\nCold";
else if(temp>1 && temp<20)
std::cout<<"Normal";
else if(temp>20 && temp<30)
std::cout<<"Moderate";
else if(temp>30 && temp<40)
std::cout<<"Hot";
else
std::cout<<"Very Hot";
return 0;
}
Output
1. Less than zero print Cold
2. between 1 - 20 print normal
3. between 21 to 30 print moderate
4. between 31 to 40 print hot
5. greater than 40 print very hot
#include <iostream>
int main()
{
int temp;
std::cout<<"Menu\nWeather Program\n";
std::cout<<"Please enter temperature value between -n to +n \n";
std::cin>>temp;
if(temp<1)
std::cout<<"\nCold";
else if(temp>1 && temp<20)
std::cout<<"Normal";
else if(temp>20 && temp<30)
std::cout<<"Moderate";
else if(temp>30 && temp<40)
std::cout<<"Hot";
else
std::cout<<"Very Hot";
return 0;
}
Output