# WSQ 05 – On To Functions

--Originally published at MarizProfile

In this activity I had to use for the first time formulas outside of the main, (not like in the last activities where all the processes took place inside of the main). I used formulas to get the result of several arithmetic operations, like a sum, a subtraction, a multiplication, a division and the remainder of it. To print those results I used a “cout” for each of the operations mentioned, and I returned to call the formula previously written above the main, writing inside the parenthesis the variables used in that formula.

-> For example (division):

int D (int x, int y){

return (x/y);

}

int x, y;

using namespace std;

int main(){

cout<< “The result of the division of those two numbers is:  ” << D(x,y) << endl;

}

# On to functions

--Originally published at Regular Blog

Para crear una función se asignan las variables con las que se quiere que trabaje y posteriormente la operación, con int…

int sum(int x, int y){
return (x+y);

–> En este caso el nombre de la función será “sum”, al lado se le asignan las variables con las que trabajará, en este caso X y Y, y entre corchetes lo que se quiere que haga; “” return (x+y) “” porque, cuando usemos esa función, queremos que nos regrese la suma de X y Y, las variables que le asignamos previamente.

Después de todo, resulta que al principio del código, cuando ponemos “” int main () “” le estamos asignando todo nuestro código a la función main, por lo que las funciones que creemos las ponemos antes de la principal (main).

# WSQ 05…

--Originally published at tc1017 – chivas4ever2009

On to functions…
Here you can see my fifth program, at first I thought it was going to be super easy because it was just about getting the sum, subtraction, product, division and remainder from two integers, through functions. When I first tried to compile it, the bash terminal marked me a lot of errors. Honestly I was annoyed, I couldn’t find my mistake. So I decided to ask for help to my classmates, shoutout to Cristo. Thanks bro, he helped with the code and he did found my mistake. It was something about the variables. After Cristo’s help I realized that it was easy because since the beginning I was kinda using functions inside of my programs. But I wasn’t calling the functions in the previous programs. The program worked and it was all set, thanks again to my friend Cristo!

**IMPORTANT STUFF**
+Be careful with your variables, otherwise the program will take them as general variables and you do not want that.
+ASK FOR HELP. Even to classmates, you can always learn something from everyone.

# Fun with numbers

--Originally published at Future Queen of C++

I have a really fun time creating this pretty program. It was not hard but elavorated and with a lot of details. I did not use any resource on this WSQ, and I felt so proud of my self because it did work without any big problem.

# WSQ 05 – On to functions

--Originally published at Solving problems with programming

The most easy assigment i have done, obviously not perfect so if you have more efficients codes please give me your feedback.

the best tip i can give you it´s to ask yours friends how functions work, I already help some of friends and my twin brother, so you can ask me if you need it too.

Haga click para ver el pase de diapositivas.

# WSQ05

--Originally published at Victor´s Spot

Today I will share how I developed another code and how I applied another one Mastery Topic from https://kenscourses.com/tc1017fall2017/mastery-topics/, which is

1. Creating function

I considered to use this topic because the programm consisted in create some functions for making easier the code, and i discovered that it is not as hard as I thought, I want to complete this task with a poem:
Functions seems complicated
But no all of them
They can be easily completed
You just need to get used to it

# On To Functions

--Originally published at Valeria CT

For this WSQ, I wrote a code that did practically the same thing that my WSQ01 did, but creating and a calling a different function for each mathematical operation. I had read about the creation of creation of function a long time ago, so I didn’t really remember how to do it. Luckily, I have an extra workspace on Cloud9 where I write short programs with the commands that I read about on the book that I feel the need to practice or that aren’t included on the WSQ’s that I’ve done so far, so I just went back to my practice code on functions and was able to do WSQ05 quickly.

My program doesn’t fit completely in the image above, so here’s a link to my code on GitHub: https://github.com/valeriact/tc1017/blob/master/wsq05.cpp

I haven’t set up completely my GitHub account nor have I installed Atom and Cygwin on my laptop because I need to update and reset my laptop first and I haven’t had the chance to do so; therefore all of my programs are on Cloud9. As soon as I have all of these set up, I’ll post an entry with the link to all of my WSQ’s.

The resource that I used for WSQ05 was the book How To Think Like a Computer Scientist.

-Valeria

# Funciónes On To

--Originally published at RON

Esta practica fue algo confusa pues no comprendía muy bien lo que nos pedía pero al checar el un post de un compañero me di una idea y lo comprendí, y ademas era lo mismo que la primero solo con variantes entonces realmente no fue muy difícil. En la parte de abajo incluyo el post y mi enlace del código .cpp.

Blog de apoyo:

https://programmingincsite.wordpress.com/2017/09/06/on-to-functions/comment-page-1/#comment-4

Haga click para ver el pase de diapositivas.

Enlace código .cpp: