Second assignment – Temperature

--Originally published at The Clueless Programmer

Here I go again, clueless programmer on the go hitting you up with another awesome blog post. That´s what I would say if I indeed made awesome blog posts. Anyway, let´s get right to it.

This time the assignment was more difficult than the last one, but still, I managed. This was the first program that asked us to use an “if” conditional (a conditional that only applies if you trigger the if).

imagen1

#include <iostream>
using namespace std;
int main()
{
int n1, n2;
cout<<“Write the temperature in Fahrenheit degrees: “;
cin>>n1;
n2=(5*(n1-32))/9;
cout<<n1<<” Fahrenheit degrees convert to “<<n2<<” Celsius degrees”<<endl;
if (n2>=100)
{
cout<<“Water boils at this temperature”<<endl;
}
else
{
cout<<“Water doesn´t boil at this temperature”<<endl;
}
}

There you have the program!

Basically what I do is ask you for a temperature in Fahrenheit degrees, which I save on a variable, then on another variable I save that Fahrenheit temperature converted into a Celsius one. Then I put the ifs down, if the conversion is bigger or the same as a hundred, water boils at that temperature, if it is lower, it doesn´t.

Simple stuff right? (I can bet karma will hit me up with a really difficult assignment really soon, but I´ll enjoy my time until then). So yeah hope you learned something, as always thanks for reading me and hang in there, program on.

 


De F° a C° y estados de la materia

--Originally published at Adal´s Blog

La actividad del día de hoy es:

Como pueden ver tenemos que hacer un código que nos ayude a convertir los grados Fahrenheit a grafos Centigrados y ademas decirnos en que estado de la materia se encuentra el agua



Paginas de ayuda

Temperature

--Originally published at Hensel

In this program I needed convert the degrees Fahrenheit in Celsius with the formula

C= 5*(F-32)/9. As you can see at the next picture…img_1791

I used the float numbers because in this case is better than int numbers. I had a problem with the conditional “if” on the line 14, because my parameter was bad, I wrote “If(C>=-5)” and when I introduced -4 degrees Fahrenheit the program showed me a mistake on the state of water. It´s for that I wrote the parameter with C>-5.

POSTSCRIPT

I´m sorry if I have a mistake in my English.


Hot Programming

--Originally published at Programming 101

Hello guys! This is my third post, as well as my third assignment. I found this assignment fun and super easy.

Basically what we had to do was to write a program that would show a temperature in Fahrenheit coverted to Celsius. In addition we had to write weather water would boil or not in the given temperature.

While I was writing my program I had little doubts. One was the correct structure for the conditional ‘if’. I did a little research and found out that I had to use these guys ‘{ }’ at the beginning and at the end of the conditional. Here’s the link I used to clarify my doubts, hopefully it can help you as well: https://www.programiz.com/c-programming/c-if-else-statement

After that I finished my program and when I ran it, I had a couple mistakes because I had forgotten to write at the end of two sentences the super famous ‘;’ semicolon. But no bigger errors appeared.

I really liked this activity and I hope y’all are doing great.

I’ll leave here my run program with the three possible outcomes and the structure I used in Atom.

Good luck guys, cheers!

captura-de-pantalla-8


How’s the weather

--Originally published at Ken&#039;s Disciple 01

Picture by Gratisography Gratisography

Welcome to WSQ02: this is an easy one.

Captura de pantalla 2017-01-31 a la(s) 13.49.09.png

As you can see in my code, what you only need is the actual formula (which is given in ken’s post). The difficult parte here may be that we need to tell the user the state of water in this temperature, it’s actually very easy, if you have no idea of how to use if functions you may want to check chapter 4 of our book. The only thing to do here is obvious, if the temperature in Celsius is lower than 0, then water is solid, if its higher that 0 but lower than 100, its liquid and if its higher than 100 its gas.

This is what the program should look like:

Captura de pantalla 2017-01-31 a la(s) 13.53.28.png

As always my code at GitHub.

Have any questions? feel free to ask.

L.out


Temperature

--Originally published at estefilangarica.wordpress.com

Third Activity

The assignment Ken gave us was the following:

Write a program that will prompt the user for a temperature in Fahrenheit and then convert it to Celsius. You may recall that the formula is C = 5 ∗ (F − 32)/9.

Modify the program to state whether or not water would boil at the temperature given.

This program was a little more challenging because we have to consider the temperature in Celsius to see what was the state of the water.

The first code I used was the following:

screen-shot-2017-01-31-at-10-41-01-am

Moments later, Ken came to check my code and he gave me some advices.

Brackets and spaces!

The code was ok, it worked perfectly; but he told me to add some spaces between numbers and symbols because it is easier to see. He also told me to adjust the text inside the brackets. Brackets are so confusing to me! I hate them. Last year I didn’t understand when I had to put brackets, but now I do. I just have to put them where it is easier for me and you to understand it and to easily see what is inside the brackets.

Updated code below!

screen-shot-2017-01-31-at-10-54-12-am

In this code I had to use the sentence if – else.

For this sentence you have to establish a condition. The condition has to be between parenthesis as shown in line 12.

If the condition is true it will “follow the first path”, if its false you can establish another condition or just leave it without a condition. If you don’t establish a second condition, it will mean  that you are considering everything that isn’t int he first condition.

In this assignment we used two conditions.

Note: Every “if” has to have an “else”!


WSQ 02 – Temperature.

--Originally published at |Blogging through my thoughts|

This is my second program , created using cygwin and atom. For this task , my classmates and I were instructed to create a program that will prompt the user for a temperature in Fahrenheit and them convert it to Celsius. The formula that made the conversion possible was  C = 5 ∗ (F − 32)/9  (where F = Fahrenheit).

The resources that helped me were:
-cpluplus.com
-How to think like a computer scientist.

I added some extra steps to show more information to the user , depending on the number (x) given , like if:

-Water boils at x temperature.

-Water is in its solid state, ice.

-Water, in its solid state, becomes liquid due to its melting point.

-Water does not boil at this temperature.

It really was a fun and entertaining task.

 

Here you will find my code and some captures:

wsq02-code
Atom code.

-Atom code:

#include <iostream>
using namespace std;

int main(){
int f,c;

cout << “This program converts temperature from Fahrenheit to Celsius.” << endl;
cout << “Give me the temperature in Fahrenheit:” << endl;
cin >> f;
cout << “The temperature is ” << f << ” Fahrenheit” << endl;

c = 5*(f-32)/9;
cout <<“The temperature expressed in Celsius is ” << c << ” Celsius” << endl;

if (c >= 100){
cout << “Water boils at this temperature.” << endl;
}
else{
if (c < 0){
cout << “Water is in its solid state, ice.” << endl;
}
else{
cout << “Water, in its solid state, becomes liquid due to its melting point.” << endl;
cout << “Water does not boil at this temperature.” << endl;
}
}
return 0;
}

wsq02-cygwin
Running on Cygwin.

 

wsq02-topics

masterytopics1
Mastery topics involved.

 

 

Until next time.

°Luis Felipe Garate Moreno.