Get logical

#TC1017 #WSQ05

This program was a temperature converter and was finished in a couple of minutes, I think the previous programms really refreshed my memory as to what C++ was. The only problem was I could not recall the proper syntax for if statements and had to check the ebook to remember.

Below’s the proof and code as usual. I ran the program twice for each possible scenario (water boiling or not).

proof_temp

Source code:

#include <iostream>
using namespace std;

float fahr;

int main(){
cout <<“What’s the temperature in Fahrenheits?” << endl;
cin >> fahr;
cout << endl;
cout <<“The equivalent temperature in Celsius is “;
cout << 5*(fahr-32)/9;
cout <<” Degrees.” << endl;
cout << endl;

if (fahr >= 212 ) {
cout << “Water boils at this temperature under normal conditions” << endl;
} else {
cout << “Water does not boil at this temperature under normal conditions” << endl;
}
}

————

CC BY-SA 4.0 Get logical by diegodamy is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.