I´m becoming more familiar with the commands of c++, right now i eventually make a programm that can convert from Fahrenheit to Celsius and vice versa.

It was kind of difficult at first, but once I saw a video about loops and if´s, well…it was all cleared out for me, now I can ressume my skills acquired in the homework in the following statements:

-You need to assign a value before the if´s

-You need to be careful with the “;”

-Dont give up!!!

here´s the video that help me improve my skills

https://www.youtube.com/watch?v=mSRs9WGrvqA

 

My code:

#include <iostream>
using namespace std;
int main(){
    int x;
    char c;



    cout<<"Choose a convertion"<<endl;
    cout<<""<<endl;
    cout<<"1. Celsius  to  Fahrenheit"<<endl;
    cout<<""<<endl;
    cout<<"2. Fahrenheit to Celsius"<<endl;
    cout<<""<<endl;
    cin>>x;
     if(x==1){
          float x;
          cout<<"Enter the temperature in Celsius degrees"<<endl;
          cout<<""<<endl;
          cin>>x;
          cout<<""<<endl;
          float y=(x*9/5)+(32);
          if (y<212){
  cout << "Water does not boil at this temperature (under typical conditions). "<<endl;
}

if (y>211)
{

  cout<< "Water does boil at this temperature (under typical conditions). "<<endl;

}
cout<< ""<<endl;
if (y<32){

  cout<< "The water is frozen"<< endl;

}
          cout<<x<<" Celsius degrees equals to "<<y<<" Fahrenheit";
      }else{
          float a;
          cout<<"Enter the temperature in fahrenheit degrees "<<endl;
          cout<<""<<endl;
          cin>>a;
          cout<<""<<endl;
          float b=(a-32)*5/9;
          if (b<212){
  cout << "Water does not boil at this temperature (under typical conditions). "<<endl;
}

if (b>211)
{

  cout<< "Water does boil at this temperature (under typical conditions). "<<endl;

}
cout<< ""<<endl;
if (b<33){

  cout<< "The water is frozen"<< endl;

}
          cout<<a<<" Fahrenheit degrees equals to "<<b<<" Celsius degrees";
      }

   return 0;
    }

 

CC BY 4.0 #WSQ05-Temperature by Ever Ibarra Almaral is licensed under a Creative Commons Attribution 4.0 International License.