Answer to Question #262804 in C++ for Nabilah

Question #262804

Program that receives the current temperature as input. If the temperature is 80 degrees or more, output a message telling the user to go swimming, otherwise, if the temperature is 50 degrees or more, output a message to go running, otherwise stay inside.

 

#include <iostream.h>

void main()

{

double temperature;

cout<<”Input Temperature :”;

cin>>temperature;

if (temperature<=80)

{cout<<”go swimming”;}

else if (temperature<=50)

{cout<<”go running”;}

else

{cout<<”stay inside”;}

}

 


1
Expert's answer
2021-11-08T09:13:41-0500
#include <iostream>
using namespace std;


void main(){
	double temperature;
	cout<<"Input Temperature: ";
	cin>>temperature;
	if (temperature>=80){
		cout<<"go swimming";
	}else if (temperature>=50 && temperature<80){
		cout<<"go running";
	}else{
		cout<<"stay inside";
	}
	cin>>temperature;
}

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