#WSQ04

--Originally published at May The Code be With You

Hello, Young Padawans!

This post is about the WSQ04 in wich, you have to create a code where you ask the user for a lower and a higher value, and the program will make a sumatory of all the numbers from the lowest to the highest value.

Something like this:

is

Nah!, Just Kidding, I don´t even know what the hell that is.

It is quite simple, you just need to make a loop with a counter that make the sumatory of all values.

wsq04

Like this. I have always had troubles with counters, but with the help of Ken and other classmates, I always find the way.

See you in the Next post!

goodbye

 


#WSQ03

--Originally published at May The Code be With You

Hello Young Padawans!

Well, I honestly though I had already done this post, but apparently, I didn´t so, here It is

This one was a litle tricky, because,  I to do some research on the internet first, to know how to get a random number in a specific range, but after i got it it was easy, so I did my code and It worked, only with one little detail, the random function always gave me the same number:

84

I don´t know why it always got me 84, but it did, ALWAYS, so I checked on some of my classmates codes and they have all something different, and that something was the:

” srand(time(NULL)); ”

This thing results to give you a different number every time the code is ran.

So the final result was something like this:

2017-02-25

2017-02-25-1

So, I just added the cookie thing because, Come On! Is a “Hole in one”, and everybody deserves a Cookie, here have one:

cookie


#WSQ02

--Originally published at May The Code be With You

Hello Young Padawans!

I know it has been a while since I wrote the last WSQ assignament, but now I am about to do it again, starting with the WSQ02.

So, let´s begin.

cfingers

First of all, this program is quite easy, because you just have to apply some formulas and get some values.

Since this program is only for converting from degrees Fahrenheit to Celsius, it´s even easier. So you just have to ask for the temperature in degrees Fahrenheit, and aply the formula to this value that, in case you haven´t noticed, it is already on the instructions part, but just in case, here is it:

fahrenheit

If you know what you are doing you must have something like this:

wsq02

If you don´t, check it again so could know what you are doing  wrong.

tup


#Quiz_Week_4

--Originally published at May The Code be With You

Hello, Young Padawans!

In this edition of my blog, I bring you the excersice for the quiz of this week, week number 4.

This has been the most difficult programm I’ve done until now, but not because of its complexity, but the functions. If you don´t understand what a function is, you may have to read chapter 3 again.

Then, let´s begin. First of all, Ken gave us some clues of how the two functions have to start, so I wrote them. after that I tried to start doing my main function, you know, the one that is the most important. After that I went back to my functions, instead of doing the two of them, I did first the “Minimum Number” first. So if that way, if I made a mistake, that would be in taht function. This one was kind of difficul because, instead of using conditionals, I used the “min” function, but the problem was that, in order for using this I had to add the “cmath” library, and the most difficult was that I didn´t realize this function is only for 2 variables. I tryed to do some internet research, but the thing that saved my ass was a code I got from the main Blog. It helped me to understad what I was doing wrong, it took me a while to figure out that, so I got stucked almost all day in that.

Doh.jpg

After that, the other function became very simple, so I just did it and that is it.

My code is something like this:

quiz4

I hope It can help you.

See ya, Padawans, and may the code be with you!


#WSQ 01

--Originally published at May The Code be With You

Hello Young Padawans!

This time I am going to help you with the first activity, the WSQ01 (I really don´t have any idea of what that means, so please, don´t ask), named “Fun with numbers”.

numbers

Don´t worry, we might be studying engineering, but this is not that complicate. This excercise is just about to write a code where it ask the user for 2 numbers and the program make the basic 4 operations with them (summatory, substraction, product and division)

Quite easy uh?, so let´s begin.

dexter

First of all is very important that you read chapter 1 and 2 from your text book, so in that way you can understand what a variable is and how to declare it.

Once you understand how to declare a variable, you must know that every result for each operation is a different variable. Then, when you have your variables declared, start with the rest of the code using “couts” for data from the computer to the user, and “cins” for the other way. So just write the variable and the operations assigned, and that is all, nothing away form our world.

So then, you must have something like this:

wsq1

Annnd, that is it, if you have any doubt don´t forget to go to your text book or write me a comment.

See ya!

Vulcano.png


#Quiz_Week_3

--Originally published at Site Title

Hello Again Young Padawans!

In this edition I will tell you how did I do the program from Quiz of the Week #3

Well first of all, the excercise tell you to do a program wich help the user to get the square and cubic root from a given number, using functions, something like this:

no-foto

No, it is not an error, it is just a picture that literaly says “No Photo Avaiable”.

First i need to tell you how did i start. Well you must read chapter 3 in order to understand it better. In that chapter there is a new header line used for math functions named:

#include <cmath>

You should put it between “<iostream” line and “using name std” line.

 


#Hello_World

--Originally published at Site Title

Hello, Young Padawans!

(I know I am also new in this thing of programming, but this is how I´m going to call you)

As many of you may know (others don´t), the “Hello World” program is ususally the first program a person does. Independiently the language him or her is learning.

It only consist on making the program proyect the phrase “Hello World” on the compiler screen.

Resultado de imagen para obviously

If you took a basic programming course previously, or “Introducción a la computación”, at the Tec, you may think it is a very easy thing to do, and it is, but not as you think.

C++ is a high level programming language, and it is very different from others like C# or Pyton, but it uses the same principles.

In order for doing this programm I had to READ the chapter one of my text book, to understand some basic concepts and also, because there is the code on page 11.

Resultado de imagen para facepalm

And it is something like this:

hello_world

As you can see, I used Atom for doing the code, and the Ubuntu Bash to compile and run it.

After analize this, I realize that I don´t understand what the libraries are (yet), but as I said before it use similar elements from othe languages like COUT, that is used to print something on the screen, some data the program is gonig to put OUT of it.

If you just copy you might not realize what you are donig, but the more programs you do the more you will understand,  so just be patient. And don´t forget to read your text book. It is not as hard as it seems.

So it is all from me

Resultado de imagen para looney tunes closing

Daniel out.