Use of comments in C++

2 min read

<iostream>

using namespace std;

int main(){//Jorge Samir Godinez Lara 01/02/2015

 

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.

              }

 

                      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;

}

 

CC BY 4.0 Use of comments in C++ by Samir Godinez is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.