WSQ02 Temperature

WHAT TO DO:

Write a program that will prompt the user for a temperature in Fahrenheit and then convert it to Celsius. You may recall that the formula is C = 5 ∗ (F − 32)/9.

Modify the program to state whether or not water would boil at the temperature given. Your output might look like the following.

EXPLANATION:

First we name the variables of f and c for the two types of grades respectively, then we gave the task of assigning the formula of the conversion to the variable c in order to convert the degrees Farhenheit to Celcius, we use a condition statement for when the result of The conversion gave a result greater than 100, write a message to inform us that it is boilingcaptura-de-pantalla-2017-02-01-a-las-18-51-39

CODE:

#include <iostream>
using namespace std;
int main() {
int F,C;
std::cout << “dame la temperatura en grados Farhenheit” << ‘\n’;
std::cin >> F;
C = 5*(F-32)/9;
std::cout << “la temperatura de ” <<F<< “grados Farhenheit en grados celcius es:” <<C<< ‘\n’;
if (C>100) {
std::cout << “el agua esta hirviendo compadre!!!” << ‘\n’;
}else {
std::cout << “el agua no hierve” << ‘\n’;
}
return 0;
};

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s