Skip to content

Instantly share code, notes, and snippets.

@samir96
Created February 17, 2015 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samir96/fd45b7e7822b2c486da0 to your computer and use it in GitHub Desktop.
Save samir96/fd45b7e7822b2c486da0 to your computer and use it in GitHub Desktop.
IF
#include <iostream>
using namespace std;
int main(){//Jorge Samir Godinez Lara
int F,C;
cout <<"\nGive me the actual temperature in Farenheit and I'll convert to Celsius: "; //This is an output line, where I ask the user for Temperature
cin >>F; //This is the variable that I use to save Farenheit Temperature
C=5*(F - 32)/9; //This is the formula to convert Farenheit degrees to Celsius.
if (C >= 100){ //Here I establish conditional, for do something in case the Celsius temperature is over and/or equal 100 degrees.
cout<<"\nA temperature of: " <<F<< " degrees Farenheit is: " <<C<< " degrees Celsius "<<endl; // This is the output I gave to the user.
cout<<"\nWater boil at this temperature"<<endl; //The output where I said the water boil at this temperature.
}
8 else{
cout<<"\nA temperature of: " <<F<< " degrees Farenheit is: " <<C<< " degrees Celsius "<<endl; // This is the output I gave to the user.
cout<<"\nWater does not boil at this temperature"<<endl;//The output where I said the water does not boil at this temperature.
}
return 0;
}
6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment