This is a program we made together Eduardo Morales, Eduardo Barrera and me, José Quiroga. I hope you like it:
Hola a todos!
Este post es sobre mi proyecto final de programación en C++, para lo cual mi equipo y yo decidimos crear una calculadora que pueda resolver integrales y derivadas que el usuario elija. Dicho lo anterior, buscamos la creación de un programa que fuera útil para nosotros y para las personas que quieran utilizarlo, creando el programa con fines prácticos para los estudiantes y sin duda alguna muy amigable y fácil de entender para el usuario. Para ello necesitamos aplicar los conocimientos adquiridos a lo largo del curso, a través del uso de funciones, vectores, librerías, entre otros.
Durante la creación de este proyecto nos enfrentamos a muchísimos problemas, ya que necesitamos crear tres diversos programas para la función del original (INTMAIN), donde pedimos todos los valores al usuario para su uso. Cabe destacar que usamos el software de VISUAL STUDIO 2012 para la creación de nuestro programa…
Ver la entrada original 252 palabras más
In this quiz we had to make a program that tells you the greatest common divisor between two integer numbers. So the program asks for the biggest number and then the smallest.
For this we have to use the Euclid’s Algorithm: (Wikipedia obviously)
The Euclidean algorithm is based on the principle that the greatest common divisor of two numbers does not change if the larger number is replaced by its difference with the smaller number. For example, 21 is the GCD of 252 and 105 (252 = 21 × 12 and 105 = 21 × 5), and the same number 21 is also the GCD of 105 and 147 = 252 − 105. Since this replacement reduces the larger of the two numbers, repeating this process gives successively smaller pairs of numbers until one of the two numbers reaches zero. When that occurs, the other number (the one that is not zero) is the GCD of the original two numbers.
Here is a video, it´s in Spanish but explains this quite good:
Thanks to Baruch who taught me how to make the loop.
In this WSQ I had to create a program that ask for numbers and then show them as a list, the total, average and standard deviation of them.
So I used a for loop with a array to ask for the numbers, the array was the quantity of numbers I would like to use for that program, so I could modify it for whatever I want to.
Then, I created the functions Total, Average and Std. Dev., the Total function could be used for the Average and the Average could be used for the Standard Deviation.
When it runs looks like this:
As you can see, this is an “easy” program but you have to make it easy to write, using functions, loops and arrays.
Now we have the Quiz number 3.
In this quiz, first we have to create a program that calculates the distance between two point in a graph using the coordinates (X, Y).
The user has to introduce the two points (X1, Y1) and (X2, Y2).
In the second program we have to do the Fibonacci sequence using just one input.
The Fibonacci sequence are the numbers in the following integer sequence.
0, 1, 1, 2, 3, 5, 8, 13, 21, …
By definition, the first two numbers in the Fibonacci sequence are either 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.
Also, the program ask the user if he wants another number of the sequence.
In this program we have to make a loop in which we find the factorial number of the one ingress by the user. Then we have to ask if he wants to ingress another number to calculate the factorial.
The factorial function (symbol: !) means to multiply a series of descending natural numbers. Example:
- 4! = 4 × 3 × 2 × 1 = 24
I´m going to use a For loop to make the factorial inside a Do-While loop to ask if he wants another number.
The code will be here at GitHub
The functions allow to structure programs in segments of code to perform individual tasks.
In this program I´m going to do the same as in the WSQ03, but using functions.
You have to enter two numbers and the program will calculate:
- 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 will leave the code on GitHub, here is the link.
In this Quiz we just had 2 exercises:
In the first exercise we had to ask for two numbers (a, b) and show the result of growing the first one to the second one. Example: (a=5, b=2) R=25
We could do this with the function Pow including the <math.h> library, or we can do it with the function For. I did it with Pow:
In the second exercise we had to show the number of stars that we ingress. Example: cin=5 R=*****
In this program we can sum the numbers between the ones you say.
For example, I you say the first number is 6 and the second 10, the sum will be 40.
So this is the code I wrote on XCode:
Also the code will be here in this link on GitHub.
The past class we have a quiz. It wasn´t that hard, in fact for me it was very easy.
The quiz consisted of 3 programs.
The first program calculates the volume of a cylinder, you just have to ingress the radio and the height.
Once you enter the data the program makes the calcule and tells you the volume.
Then we have to make a program that calculates the product, integer and remainder of two numbers using int variables. It´s like the WSQ03.
The last program is almost the same but using float variables, adding the sume and difference of the numbers, and taking away the remainder.
Once we finished the quiz we had to send it to our teacher.
Here is one of my friends post about this quiz.