Answer to Question #273617 in C++ for Nick

Question #273617

Absolute zero is the lowest temperature that can be reached; it is -273.15°c, or 0k. The above preogram, even when corrected l, will produce erroneous results when given a temperature below zero, Place a check in the main program that will produce an error if a temperature is given below -273.15°c.

1
Expert's answer
2021-11-30T18:41:46-0500
#include <iostream>
using namespace std;
int main()
{
    signed long a= -273.15, b;
    // prompt user to enter temperature in degree celcius 
    cout<<"Enter temperature in degree celcius:";
    cin>>b;
    /* use if condition statement to check if the entered temperature is less that the given temperature*/
    if(b<a){
        cout<<"Error!!!";
    }
    else{
        cout<<"The temperature is above  -273.15";
    }
    
    cout<<b;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS