#WSQ02 Post Temperature 23/01/17 and WSQ02.cpp

--Originally published at Solving Problems with Programming

Link of the picture: link of the picture

So in this fifth class that I had on last Monday we started how to make a program with conditions in C++.#Mastery10

What I did for this numeric program is solving the problem to the user by writing a program that will prompt the user for a temperature in Fahrenheit and then convert it to Celsius with the formula C = 5 ∗ (F-32)/9.

After that I modified the program to state whether or not water would boil at the temperature given.

The following photograph shows the solution to this problem:

temperature1

Picture of Author

So at first I wrote the same structure of the program just did the same as what i did in Hello World: Second Class, Second Blog (Blog of the second class 12/01/17) and Hello World.cpp and #WSQ01 Post Fun with Numbers 16/01/17 and WSQ1.cpp where i explained the application of the #MasteryTopic01 that it is for comments that could be very useful when debugging and #MasteryTopic04 that is basic output for data.

What i first put in the code was the library <iostream> to call all the fuctions of inputs and outputs of data in languague C++ #MasteryTopic06 Calling Functions and #MasteryTopic08 Importing and using libraries.

code

Then i had to write a command that everytime goes with the instructions of input and outputs of data that is call std but with this command helps writing these std out of the main because the machine factorizes them.

Next I initialize the begin of my program int main().

After that i had to declarate just one basic type of variable in decimal  value for using in the math process of  C = 5 ∗ (F-32)/9. #Mastery03 #MasteryTopic03  because the program will show the value in a float way in celsius degrees.

Next

if
something-or-something-else-on
code
code2t
states
Continue reading "#WSQ02 Post Temperature 23/01/17 and WSQ02.cpp"

Temperature

--Originally published at Loading…

This was easy. Ken ask us to make a program…

“That will prompt the user for a temperature in Fahrenheit and then convert it to Celsius. Modify the program to state whether or not water would boil at the temperature given.”

As always the first thing that I did was to declare my variable. Then I put the cout instruction for show the question, and the cin for the user could write the temperature. After I write the formula for convert the Fahrenheit in to Celsius. And this was my code:

tempphoto

But it wasn’t as easy as it shows ‘cause I’m very distracted and I forget many things so it didn’t compiled very well 😞

TempPhoto2.jpg

SECOND PART

After all the mess that I did, Ken told me to be a pro and make my program said the state of the water at that temperature… I know that I can make it with an if instruction, but I forgot how I can use 3 conditions in an if, so I searched in St. Google and I found a page that helped me to finish my program, and this is my final code:

tempphoto3tempphoto4


Temperature

--Originally published at how not to program

This code converts Fahrenheit degrees to Celsius and tells you if at that temperature the water boils or not.wsq02

If you want to make improvements or modifications, here is the code for you to copy and paste it anywhere.

#include <iostream>
using namespace std;

int dgf, dgc;

int main (){
cout <<“Type in degrees in Farenheit”<< endl;
cin >> dgf;
dgc= 5*(dgf-32)/9;

if (dgc>=100) {
cout << dgf <<” degrees Farenheit are “<< dgc <<” degrees in Celsius”<< endl;
cout << “Water usually boils at this temperature”<<endl;
}
else {
cout << dgf <<” degrees Farenheit are “<< dgc <<” degrees in Celsius”<< endl;
cout << “Water usually not boils at this temperature”<< endl;
}
return 0;
}


Temperature (F° to C°)

--Originally published at TC1017

Hello, this is my #WSQ02 program for week 3, this task consisted in creating a program that coverted a temperature typed by the user in Fahrenheit and change it to degrees and tell the user if the temperature can boil water or not. This program was still easy for me and I needed no help from friends or research on internet.

Here´s the program and its result:

#include <iostream>

using namespace std;

double c,f;

int main(){

cout << “Type a temperature in Fahrenheit: “;
cin >> f;

c=5*(f-32)/9;
cout << “The temperature in celsius is: ” <<c<<endl;
if (c>=100){
cout << “Water does boil in this temperature (under typical conditions): ” << endl;
}
else{
cout << “Water does not boil in this temperature (under typical conditions)”<<endl;
}

return 0;
}

temperature.jpg


WSQ02

--Originally published at TC1017 Solving Problems with Programming

Hi there, today I have another program that will be useful for you if you don´t live in the US and you have a bad time converting your measure system.

This little program will convert for you from fahrenheit to celsious in no time and will also tell you if the water would boil in that specific temperature.

Enjoy the program!captura-de-pantalla-2017-01-26-a-las-19-52-08


WSQ 02

--Originally published at Programming the city

This program was  easier than the others, I liked it because it helps you to practice and develope new skills.

Here is the code…


#include
#include using namespace std;
int main () {
double fa, ce;

cout<<“Give a temperature in Fahrenheit “; cin>>fa;

ce=5*(fa-32)/9;

if (ce>=100)
cout<<“The conversion from Fahrenheit to Celsius of the number you just gave me is “<<ce<<” at that temperature, water boils”;
else
{
cout<<“The conversion from Fahrenheit to Celsius of the number you just gave me is “<<ce<<” at that temperature, water doesn’t boil”;
}
return 0;
}


wsq02

#TC1017

#WSQ02


WSQ02 – Temperature (and some easter eggs)

--Originally published at The Talking Chalk

One game I love is Halo 3, it was one of my first video-games in my first  console, and what marveled me of this game was how much I could explore, how many combinations there were for the equipment, weaponary and strategies to defeat a certain group of enemies; however, what surely made this game special were its “easter eggs“.

halo3

(image from halowaypoint.com)

For those who do not know the term outisde from easter holidays, an easter egg is something hidden in a video-game, movie, or any media that was completely made by humans (media such as news and live sports games do not have easter eggs at all), and usually serves as a gift, a curiosity, a fun relief, or an extention of the media itself.

For this code, I decided to hide my own easter egg.

halo3yo

The first problem I faced when writing the code for temperature was the use of if and else. From the little I learned from python, to make an if and else statement work, it is important to properly specify the conditions in which something will happen, other event would happen o nothing would happen.

I easily found how to use if and else by glancing at the image of code at http://www.aboutcodes.com/2012/07/else-if-statement-in-c-with-example.html , so I only wrote the else and if statement so it would give whether water boils, solidifies or stays liquid, and do the proper mathematical operation for the Farenheit to Celcius degrees convertion.

And that was it…

…until I tried to put my easter egg.

My easter egg consists on the following:

“If the final result in Celsius degrees is lower than the absolute zero (which is -273°C), the program will ask the user for what have they done, so they can type

cingetline
temperature1
temperature2
Continue reading "WSQ02 – Temperature (and some easter eggs)"

Ask F° and I’ll give you C°

--Originally published at Programming Path

Hello! This is the summery of #WSQ02. The task was to write a program that will ask the user the temperature in Fahrenheit then convert it to Celsius and also if at that temperature the water boils.

This is my code:

temperatura

#include <iostream>
using namespace std;
int main() {
int a, b;
cout <<“Give the temperature in Fahrenheit? “;
cin >> a;

b = ((5*(a-32))/9);
cout << endl << “The temperature in Celcius is ” << b << endl;

if (b >= 100) {
cout << “At this temperature water does boil.”;
}
else {
cout << “At this temperature water DOESN’T boil.”;
}
cout << endl;
return 0;
}

In this program we had to use if.. else it is not that hard to understand, I think is one of the easiest to use. In this example we just need to tell the program that if the number that is given is equal or higher than 100 then the water boils else the water does not boils. That all there is to do, besides the formula to convert F° to C°.

Hope it helped you.


Temperature in Celsius

--Originally published at my programming blog

So this week my assignment was to ask the user to give me a temperature in Fahrenheit and my program would give the user the temperature in Celsius and tell him the state of water in that temperature.

I included some mastery topics, I used nested ifs, the use of ifs and elses.

It wasn’t hard, I enjoyed this assignment! I thought the use of ifs would be hard but I understood it pretty fast.

If you don’t understand the use of ifs, I’ll explain what I did, so I just put an if and inside that if I added another if and after that if an else. So first I thought okay.. if the degrees in Celsius are more or equal to a 100, water was gas, then inside that if I added if the degrees where less or equal to 0 water was  solid and if it wasn’t neither of them water was liquid.

This is my code:

screen-shot-2017-01-26-at-10-36-44-am

#include <iostream>
using namespace std;
int main()
{
int F, C;
cout<< “Do you want to convert Fahrenheit to Celsius?”<<endl;
cout<< “And know what is the state of water in that temperature?”<<endl;
cout<< “Let’s begin!”<< endl;
cout<< “What is the temperature in Fahrenheit?”<<endl;
cin>> F;
cout<< “A temperature of “<<F<< ” degrees Fahrenheit is: “<<endl;

C=5*(F-32)/9;
cout<< C << ” degrees Celsius” << endl;
if (C>=100) {
cout<< “Water is in a gas state.”<< endl;
} else {
if (C<=0) {
cout<< “Water is in a solid state.”<< endl;
} else {
cout<< “Water is in a liquid state.”<< endl;
}

}
return 0;
}

And this how it looks once the program runs:

screen-shot-2017-01-26-at-10-37-39-am