Answer to Question #47563 in C++ for krad
Question #47563
3. Write a program that examines the value of a variable call temp. then display the following messages, depending on the value assigned to temp.
Temperature Message
Less than 0 ICE
Between 0 and 100 WATER
Exceeds 100 STEAM
Temperature Message
Less than 0 ICE
Between 0 and 100 WATER
Exceeds 100 STEAM
Expert's answer
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <cstdlib>
using namespace std;
int main()
{
float temp;
cout<<"Enter the temperature"<<endl;
cin>>temp;
if (temp < 0) cout<<"ICE"<<endl;
else
if (temp >= 0 && temp <= 100) cout<<"WATER"<<endl;
else
cout<<"STEAM"<<endl;
system("pause");
return 0;
}
#include <iostream>
#include <stdio.h>
#include <cstdlib>
using namespace std;
int main()
{
float temp;
cout<<"Enter the temperature"<<endl;
cin>>temp;
if (temp < 0) cout<<"ICE"<<endl;
else
if (temp >= 0 && temp <= 100) cout<<"WATER"<<endl;
else
cout<<"STEAM"<<endl;
system("pause");
return 0;
}
Need a fast expert's response?
Submit orderand get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments
Leave a comment