Quiz#1

馃檪

Screen Shot 2016-01-29 at 7.30.39 PM

A diferencia del programa dos, en este lo que se buscaba es que todas las variables fueran declaradas en float para que se obtengan solo enteros. Adem谩s se agregaron las funciones de suma y resta.Screen Shot 2016-01-29 at 7.30.35 PM

En este programa se pide dos n煤meros al usuario y con las funciones de multiplicaci贸n, residuo y divisi贸n, se obtienen los resultados. En la divisi贸n se declaro como Float para que el resultado se tenga como entero. Screen Shot 2016-01-29 at 7.30.26 PM

En este programa la funci贸n que realiza es imprimir el resultado del volumen de un cilindro. Las variables del radio y altura fueron declaradas como float, para obtener el resultado se utiliz贸 la f贸rmula de (3.14 * ((radius)^2) * (height)).

Quiz 1

Hello dear readers! Hope you are having a great day. Here I麓ll explain all about the first Quizz of the semester, so if you are still interested in knowing about it keep reading!

So for the first quizz, we were asked to solve some pretty easy tasks with a C++ program. The first task was to make a program capable of solving the volume of a cylinder. The machine would get the radius and height of any cylinder as paramaters and solve for the volume.聽聽The equation for the volume of a cylinder is V = 3.14 * H * R. H is equal to the height and R is equal to the radius of the cylinder.

For this program, I made a function called “volume” with two float variables as parameters, wich were the height and radius respectly. Here you can have a quick look at the code:

#include <iostream>
#define pi = 3.1415

using namespace std;

float r, h;聽

float volume(float r, float h){

float v = 3.1415 *(r*r)*h;

return v;
}

int main(){

cout << “Provide the radius of the cylinder: ” << endl;
cin >> r;

cout << Provide the height of the cylinder: ” << endl;
cin >> h;
cout << “The volume of your cylinder is equal to: ” << volume(r,h) << endl;
}

Pretty simple huh? Well that was just the first part of the quizz. On the next two parts, we were asked to make a program capable of solving basic arithmetic operations (addition, divition, multiplication, substraction). The only difference between the two of them was that the first one was supposed to be done using float variables, so you would be able to get the remainder of a division. To get the remainder, I used mod (%), wich

Continue reading “Quiz 1”

First Quiz!

The Quiz was made of 3 programs.

You can find the quiz on the following link:聽http://kenscourses.com/tc101winter2016/wp-content/uploads/2016/01/tc1017quiz1.pdf

The first program was about a program that can calculate the volume of a cylinder, you can see how it run in the following pictures:

Click to view slideshow.

The code for the first program is here:

https://gist.github.com/batmantec/3c0bc660c910ba72653e

The second program was about asking the user for 2 integer numbers and then multiply the, get the integer division, and the remainder of the division, you can see how it run in the following pictures:

Click to view slideshow.

You can find the code in the following link:聽https://gist.github.com/batmantec/725115330c7a65467d16

And finally the third one was something like the second one, but here we need to use decimal and then add the mathematical operation of sum and rest, but we take out the remainder of the division. Here are the pictures of the program running:

Click to view slideshow.

And the code is in the following link:聽https://gist.github.com/batmantec/1dc384374e1c16f8813c

 

A not so scary quiz

#TC1017 #QUIZ1

Today we had the first quiz. I’m glad to say aside from some minor typing mistakes I really found the 3 problems quite easy to solve.

Prog1:

prog1.proof

Prog2:

prog3.proof

Prog3:

prog2.proof

The three programms basically requiered the same knowledge, just how to declare int variables and ask the user for input as well as basic arithmetic. Nothing really challenging here 馃榾