QUIZ 1

El quiz 1 fue dividido en tres programas, el primero se utiliza para calcular el volumen de un cilindro, el segundo calcula algunas operaciones básicas, y el tercero y ultimo es similar al segundo solo que en este las funciones son un poco más complejas aquí dejó mis instrucciones y código de cada uno:

//CODE 1:

#include <iostream>
using namespace std;

int main(int argc, char const *argv[]) {
float radius, height, volume;

std::cout << “This program can determine the volume of a cylinder.” << std::endl;
std::cout << “Please enter the value of the radius of the cylinder.” << std::endl;
std::cin >> radius;
std::cout << “Please enter the height of the cylinder.” << std::endl;
std::cin >> height;
volume=(3.1415*(radius*radius)*height);
std::cout << “The volume of the cylinder is “<<volume << std::endl;

return 0;
}

 

//CODE 2:

#include <iostream>
using namespace std;

int main(int argc, char const *argv[]) {
int n1, n2, r1, r2, r3;
std::cout << “This program can determine the product, integer division and the remainder of two random numbers.” << std::endl;
std::cout << “Please enter the first number.” << std::endl;
std::cin >> n1;
std::cout << “Please enter the second number.” << std::endl;
std::cin >> n2;
r1=n1*n2;
r2=n1/n2;
r3=n1%n2;
std::cout << “The product of the two numbers is… “<<r1 << std::endl;
std::cout << “The integer division of the two numbers is… “<<r2 << std::endl;
std::cout << “The remainder of the two numbers is… “<<r3 << std::endl;
return 0;
}

//CODE 3:

#include <iostream>
using namespace std;

int main(int argc, char const *argv[]) {
float n1, n2, r1, r2, r3, r4;
std::cout << “This program can determine the product, integer division and the remainder of two random numbers.” << std::endl;
std::cout << “Please enter the first number.” << std::endl;
std::cin >> n1;
std::cout

“Please enter the second number.” << std::endl;
std::cin >> n2;
r1=n1+n2;
r2=n1-n2;
r3=n1*n2;
r4=n1/n2;
std::cout << “The sum of the two numbers is… “<<r1 << std::endl;
std::cout << “The difference division of the two numbers is… “<<r2 << std::endl;
std::cout << “The product of the two numbers is… “<<r3 << std::endl;
std::cout << “The division of the two numbers is… “<<r4 << std::endl;
return 0;
}

CC BY-SA 4.0 QUIZ 1 by lilihecblog is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.