On to the functions WSQ08

In this problem we need to use functions, I use this website to know how to use it: http://www.cplusplus.com/doc/tutorial/functions/

For doing this program, first I read the post on the website listed above and then I try to run the code like 3 times, before I get it right. After all this trouble to know it works I get done. Here I leave the pictures of the program running:

WQS08-

WQS08

The link to the code is here: https://gist.github.com/batmantec/ea5b00180c06988e72ab

On To Functions

Esta practica tiene la misma función a la de Fun with numbers (#WSQ03) la diferencia es que en este código tuve que escribir una función para cada operación que realizaría el programa, de esta manera solo se pedían los dos números al usuario y automáticamente se le mostraba el resultado de las operaciones de dicho código.

On_To_Functions

El código que yo realice se encuentra en la siguiente liga de Dropbox, así como los demás que he realizado durante mi proceso de este curso.

https://www.dropbox.com/home/C%2B%2B%20TC101

#WSQ08

#include <iostream>
using namespace std;

int a, b, r, m, d, rem;

int resta(int x,int y){
r=x-y;
return (r);
}
int mult(int x,int y){
m=x*y;
return(m);
}
int div(int x,int y){
d=x/y;
return(d);
}
int re(int x,int y){
rem=x%y;
return(rem);
}

int main(){
cout<< “Give me two integers values”<< endl;
cin>>a;
cin>>b;
cout << “resta= ” << resta(a,b) << endl;
cout << “multiplicacion= ” << mult(a,b) << endl;
cout << “división= ” << div(a,b) << endl;
cout << “residuo= ” << re(a,b) << endl;

return 0;

}