Ask Question
7 March, 23:00

Create a variable 'temp' and assign the value in Celsius. Display the message 'It's extremely hot day today!' if the temperature is greater than 40oC otherwise, displays 'It's not too hot!

+2
Answers (1)
  1. 7 March, 23:50
    0
    This code is written using C++

    Comments are used for explanatory purpose

    Program starts here

    #include

    using namespace std;

    int main () {

    int temp;

    //Prompt user for input

    cout<<"Enter temperature (in Celcius) : ";

    //Check if input is acceptable

    while (! (cin>>temp)) {

    cout << "That was invalid. Enter a valid digit: "<
    cin. clear (); / / reset the failed input

    cin. ignore (123,'/n'); //Discard previous input

    }

    //Check if temp is greater than 40

    if (temp>40) {

    cout<<"It's extremely hot day today!";

    }

    else{//If otherwise

    cout<<"It's not too hot!";

    }

    return 0;

    }

    //End of Program
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Create a variable 'temp' and assign the value in Celsius. Display the message 'It's extremely hot day today!' if the temperature is greater ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers