Catching up.

Well hello! We meet again. So, after a rough past week (breaking up with my girlfriend of almost 2 years and 2 mid-partials)… I’m starting to feel a lil bit better so here we are, I’m way behind on assigments but luckily there’s no deadline. I will probably write about feelings in some future post, I don’t care, I can write whatever the fuck I want, right?

So, moving onto important matters, I looked up some codes from my friends to get some idea how to write de #WSQ03 Fun with numbers, and after seeing different methods, seems I took a bit of all worlds. Here’s my work:

The code, written in Atom:

wsq03 code

The executable on Cygwin:

wsq03 exe

That’s it, I had to search St. Google for how to get the remainder, found out it’s the same as in C#, which I took last semester, using Visual Studio.

Now what? I still got a lot to do and read, and feelings-wise, as I heard somewhere I don’t really remember: “Going up shit creek without a paddle.”

This is goodbye for now. Just to leave you with another quote I like:

“Stay hungy, stay foolish” – Steve Jobs

Fun with numbers

Hello.

In this post I will show you basic math operations. Here’s the instructions:

  • 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 this is the code:

numeros

It is a basic structure to have the difference, product, integer division and ramainder. As you can see I used variables. The variable tells the compiler where and how much to create the storage for the variable (http://www.tutorialspoint.com/cplusplus/cpp_ variable_types.htm).

The basic variable of Integer numbers is INT. As you can see in the image you have to write next to INT the variables that you want to use. In this case we have 6:

  1. num1
  2. num2
  3. resta
  4. producto
  5. division
  6. residuo

But now we are using CIN. The opposite of COUT. We have to use it when we want to ask to the user for values and put it here:

numeros1

Under the COUT.

Then we write the operations with the respective variable.

Finally COUT is used to write the final message. To present the variable you have to write it between << variable << and it will show up the answer.

 

Thank you for see my post! See you Later.

 

« Fun with numbers »

The code we have to write for this task needs the following requirements:

  • 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.

I didn’t have any problems programming this, because I have programmed before in c++

This is the link to my code in Github → https://github.com/mfcanov/FunWithNumbers.git

#WSQ03 Fun With Numbers

Hello people!!, this is my new project on C++ and it’s called Fun With Numbers, made on Atom Editor and runned by Cygwin Terminal. I found easy to make it because I was reading about C++ on the link : http://www.cplusplus.com/doc/tutorial/variables/  , so I can do the project without any problem.

The new work to do in “Fun With Numbers”, is ask to the user for two values, and then, made some basic arithmetic operations. To do this, you have to declare the variables that are you asking or using, and then make the arithmetic.

funwn

And here is the program running on Cygwin Terminal.

fwn

The new commmands that I learned on this program were:

cin<<; that is used to read the value

int; to use integer numbers.

 

If you want to see the complete program go to the next link: https://github.com/eduardomrlsg/TC101/blob/master/funwithnumbers

#WSQ03 Este e un programa para calcular 4 diferentes operaciones

operacionesatom
Este es un programa para calcular la resta, multiplicación, división y module de dos numeros, para los que sobre todo no saben que es el module, module significa que en ves de darte el resultado de la división, te va a dar el residuo, es decir, en mi programa la división de 2/2 es 1, y cuanto sobra? 0, por lo cual el resultado del module, no será 1 como en la división, sino 0, también toma en cuenta que éste se representa con el símbolo de porcentaje “%” Entonces, en este programa se piden dos números denominados como x y y, que se están pidiendo al usuario, y también se pone el nombre de donde se guardaran dichos resultados, como resta, multiplicación división, module, no tienen que ser esos nombres, puedes guardarlos como tu quieras, cabe mencionar que el cout es para que imprima un texto y cin es para que se guarde una variable.
operaciones
Como aquí se observa, esta compilado el programa que anteriormente había explicado en el post anterior, pero igual dejo el link al final, y como se puede ver, los resultados de las operaciones son correctas.para ver como compilar en cygwin

 

Fun with numbers

Este es mi programa para en donde se reciben dos números y se realizan diferentes operaciones con esos dos números que se insertan, tales como resta, multiplicación, división y el residuo de esa división. este es el link de mi codigo.

yo para poder hacer este primer código, me tuve que apoyar en esta página, https://mx.answers.yahoo.com/question/index?qid=20130501130715AAsptxb todavía no entendí porque puso, PAUSE al final pero ignorando ese paso, y considerando conocimientos previos que tenia gracias al manejo de C#, pude hacer correr ese código.

 

¡Diversión con números! #WSQ03

Bueno, este programa fue muy fácil de hacer y… Aunque la forma de hacer este tipo de programas en este lenguaje de programación es muy similar a otros, la sintaxis más bien parece confundirnos un poco. Esta confusión es alimentada por nuestros conocimientos previos de otros lenguajes tales como C# o Java.

Lo primero que hice fue conseguir los libros necesarios (es español por supuesto) para aprender la manera correcta de llamar órdenes para posteriormente ejecutarlas y que el programa hiciera justo lo que yo quería que hiciera y este es mi código final.

code

Inmediatamente después de nuestro comentario acerca de lo que nuestro programa hace imprimimos un mensaje en pantalla animando a el usuario a introducir el primer dígito para posteriormente hacer las operaciones correspondientes, para lograr nuestro cometido primero nombramos a nuestra primera variable como ‘numero_a‘ esta variable estará seguida de un signo igual lo que significa que le asignaremos un valor, este valor será un valor en forma de dígito numérico que el usuario introduzca en la consola. Para esto usamos la orden ‘int(input())‘, la palabra ‘input()‘ nos indica que la consola se pausará un momento hasta que el usuario introduzca un valor, este puede ser un número o una letra mientras que la palabra ‘int()‘ nos ayudará a convertir el valor que el usuario introduzca a un valor entero (integer). La forma en que planteamos esta orden, ‘int(input())‘ es un buen ejemplo de que la Python y la concatenación de órdenes no están peleados de ningún modo.

Las demás variables son muy claras en cuanto a lo que significan con excepción de ‘.format(cociente)‘. Este orden puede parecer confusa al principio, pero con el tiempo se volverá de lo más normal pues es

Python.svg

Continue reading “¡Diversión con números! #WSQ03”

WSQ03 – Fun With Numbers

código

#include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;
int main()
{
float num1,num2,resultado;
int div;
char des, sig;
cout <<“Dame un numero”<< endl;
cin>>num1;
cout <<“Dame otro numero”<< endl;
cin>>num2;
do
{
cout <<“¿Que operacion quieres? Suma=S, resta=R, division entera=E, division con decimales=D”;
cin>>des;
switch(des)
{
case ‘S’:
case ‘s’:
resultado=num1+num2;
cout <<“El resultado es “<<resultado;
break;
case ‘R’:
case ‘r’:
resultado=num1-num2;
cout <<“El resultado es “<<resultado;
break;
case ‘E’:
case ‘e’:
div=(int)num1/num2;
cout <<“El resultado es “<<div;
break;
case ‘D’:
case ‘d’:
resultado=num1/num2;
cout <<“El resultado es “<<resultado;
break;
default:
cout <<“No elegiste algo”;
break;
}
cout <<“n¿Quieres continuar? si=s, no=n”;
cin>>sig;
} while(sig==’s’);
getchar();
return 0;
}