·On to functions· #WSQ08

And now, we were supposed to be able to call functions and learn how to use them. For this program, the functions didn’t help a lot but if you have a more complicated program, they could be really important. I had to look for how to use them. Also I asked some friends who have already passed this course.

Here is a screenshot of my code, also you can see it on GitHub. Link GitHub. As you can see, I’m recording more videos of my codes and all that stuff, I find it very useful when you’re not able to take a screenshot of the whole code. Here you can see a video of the whole code on ScreenCast.

Captura de pantalla 2016-02-02 a las 23.25.25

Captura de pantalla 2016-02-02 a las 23.25.36.png

As you can see, the default function is main but you can call other functions and write different things in each one, giving a range of values. Then in your main function you call the other functions, for example “int difference” and it is supposed that it will print the difference between the two values given.

And if you click here, you can see a video of my code working via ScreenCast.

Captura de pantalla 2016-02-02 a las 23.26.46.png

Alex H.

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/

#WQ02 HELLO WORLD!

Hey class, it is me again with another #WSQ. This time i will show you my first program. I must admit I was scared and nervous i had not an idea about c++ and it coding lenguage, but my friend chuy have already taken the class, so he is kind of an advanced guy and he help me everytime I do not know what to do.

So here is my program, i did not take screenshots beacuase you won’t see my code.

My first program

Line 1: First of all, you must include a library  which allows you the in and put standard devices, so here is the drafting.

Line 2: Int (integer) is the type of variable you are using and for every program you must have a principale variable which is called main, it will start empty. You are going to code everything between the brackets after the variable.

These are the two things you must code in every program. Then you write whatever you are asked to. Here i just have to print a line.

line 4: Here is the function of the program. I have declared the cout so I can print the line and after that I write what I want the computer to print

line5: As i have said, main starts empty, but at the end I gave it one value, 0, this means the program ends correctly

As I am posting and learning how to program in english and my teacher is canadian, i hope this image helps him to improve his spanish skills

12659798_1151422071549034_1594265071_n

 

 

 

Quiz!

Well we had to do a quiz.

Here is the quiz

So I decided to do it by hand, because I thought it would be easier and faster, here goes first program, the problem you had to do was simply calculating the Volume of a cylinder, using the formula. I used ( Pi*(radius*radius)*height)or(3.1416*(radius*radius)*height) or you can use Pi=3.1416, which I think would the best way to do it.

1st and 2nd lines: insert a radius and a height.

Remember to use int to define radius,  height

3rd : add the formula for Volume.

4th: print the result of the formula.

IMG_6566

Next program was a simple calculator who would multiply two numbers that the user would choose, then the division without remainder,  and finally you would get the remainder of the division.

1st & 2nd : ask the user for two numbers, num1 & num2

Remember to use int to define num1, num2

3rd, 4th & 5th : write what the result of each operation will be (num1*num2)(num1/num2) (num1%num2)

IMG_6567

 

Finally we should repeat the 2nd program but this time using “float” instead of “int” and do the addition,  substraction, multiplication, and division of two numbers.

1st & 2nd : ask the user for two numbers, num1 & num2

Remember to use float instead of int to define num1, num2

3rd, 4th, 5th & 6th : write what the result of each operation will be (num1*num2)(num1+num2)(num1-num2)(num1/num2) (num1%num2)

IMG_6568.JPG

That was basically the quiz we had to do in order to prove ourselfes of how much we were capable of doing on our own.

 

 

 

·Pick a number· #WSQ06

I had the task to write a program which could use a random number between the 1 and 100 and let the user play a game trying to guess that number. First of all, I had to look for how to print a random number. Honestly I didn’t save the pages where I found the information but if you type it on Google you won’t have any problem finding the libraries and the commands to print a random number.

Then I used a loop, so the user could keep guessing the number that the program had selected as default. Also I used a counter which would tell the user how many times he had tried guessing the number.

Here is a screenshot of how I wrote the program. Also you can find my code on GitHub. Link.

Captura de pantalla 2016-01-22 a las 18.39.31

Captura de pantalla 2016-01-29 a las 12.24.35

You can see a video of my program working on ScreenCast. Link.

Captura de pantalla 2016-01-29 a las 12.25.18

Alex H.

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/

#Wsq01 GET CODING!

Hello class, sorry I had a delay posting. I did not have a computer so i was a little bit delayed, but here is my experencie intalling our programs.

As i have said i did not have a computer, this mean the first classes i just wathced what my classmates were doing, all the tips ken gives to them and the procedures they made to download cygwin and atom.

Downloading cygwin was very easy, beacuase i had learned the to achieve it, so it took me like 5 minutes, on the other hand atom was no that easy, i did not know all the instructions i had to follow, the result was that i download only the setup, twice jajaja, after this i decide to try another program, therefore I am using notepad++, and let me tell you something is really easy creating programs in it.

cygwin

Here they are.

·Temperature· #WSQ05

Welcome back! Now, I “decided” to write a program who can help anybody to convert a temperature in Fahrenheit to Celsius which it is very useful. First of all, I had to look for the formula in order to know how to convert any temperature from Fahrenheit to Celsius which is this one: C = 5 ∗ (F − 32)/9.

Then, I started writing the code asking the user to give a temperature in Fahrenheit, so the program could convert it to Celsius and tell her/him if the water boils at that temperature.

Here is a screenshot of my code and also you can find it on GitHub. Link

Captura de pantalla 2016-01-25 a las 0.35.06

And here you can see a video of my code working: Link

Captura de pantalla 2016-01-27 a las 13.23.05.png

 

Alex H.

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/

#WSQ05 Random Numbers

Hello Class today we’ll be looking at generating random numbers, but not actually to generate them but, you must try to guess them…

I didn’t knew how to do this, but thanks to Batmantec I realized how to do it, and why it was this way; anyways here is the code in case you might need it.

Take a look of how it should look when you are done.

Screenshot6.1.png

On the other hand, here is a picture of the code… It’s actually “originality”

Screenshot6.2

 

 

Now here it’s a picture of Manzanillo

DCIM100GOPRO
Manzanillo upside down: By Miguel Jiménez https://www.flickr.com/photos/139404735@N04/24630233695/in/dateposted-public/

 

 

 

#WSQ05 -Temperature

In order to complete this new task you must follow next steps.

1st Open Notepad++ Screenshot5.1

2nd Start working on your code, and use the formula given by Mr. Ken

Screenshot5.2

3rd Always keep on checking wether your code works or doesn’t. I did it many times until someone told me it wasn’t .a/. but ./a.

Screenshot5.3.png

If you need to check your code… Here is mine

 

4298911131_ffbae9b3bd_z
Rachel Johnson: I program in my sleep https://www.flickr.com/photos/rachel-johnson/4298911131/sizes/z/

 

·Fun with numbers· #WSQ03

Well, another homework… haha just kidding. I’m learning how to improve my codes and all that stuff. I started reading some articles and looking for examples in c++, as I said previously, I didn’t remember how to write in c++. I spent a time exploring this helpful page. There a lot of tutorials in c++ and references.

Captura de pantalla 2016-01-22 a las 12.03.43

After reading for a while some tutorials and articles, I decided to start writing my code. My objective was to create a program that given two numbers, it could calculate different operations. I looked in some of my classmate’s programs in order to remember how to write all de cout and cin stuff.

And here is the result, after a few mistakes and trying to figure it out what was wrong, my program was finally running!

Captura de pantalla 2016-01-22 a las 12.16.38

And here is my program working in Terminal…

Captura de pantalla 2016-01-22 a las 12.18.30

Also, you can see my code on GitHub here

Captura de pantalla 2016-01-22 a las 12.20.30

Alex H.

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/

Fun with Numbers #WSQ03

Task today was to ask for 2 integer numbers in order to do various mathematical operations.

  • The difference of the two numbers.
  • The product of the two numbers.
  • The integer based division of the two numbers (so no decimal point). First divided by second.
  • The remainder of integer division of the two numbers.
  • And as a bonus, addition.

First ask for the numbers:

Screenshot4.1

Second, write the commands the program will run:

Screenshot4.2

Third, thing to do is to compile your program.

Screenshot4.3.png

Next, you must run it

Screenshot4.4

And there you have it… Really simple program, but I had help from my friend Christian, because he knows more than me 😀

 

5397869877_ce1fd0e087_z
.numbers by: .Thomas Alexander https://www.flickr.com/photos/thomasspeller/5397869877/in/photolist-9dZuE2-fcVveb-dJQF46-ipz26T-y9DdY-wiAw81-5NnYx5-fQ6qDt-6UtG9S-kD9Lqt-Cas4r9-466Ys3-7gpM2X-5pmhD5-6px3YT-7r4UdN-bFwnMH-4CzFUi-6pBcjh-jXBuPc-9rLSJU-eiMSjS-51NuHQ-9UAzzu-AzrwCH-aYjhbM-orXCLa-6mCuiz-kaLZFH-5Y6Zhn-eZ8wJY-7H8vPq-3KxvG-r4m9Jk-5peSdV-4Ne9WF-65W2Xp-jr9JBi-p8ZxD6-kAtk2a-c8agC-9A4eFW-uuRGf7-9fdyfV-4umSgE-9djrNk-fwQwZH-uAVhM-3ZwQB4-4hkQiy