P
O
R
T
A
F
Ó
L
I
O
SOLIS VILCARIMA ROBERTO CARLOS
LABORATORIO 10
#include <iostream>
using namespace std;
const float R = 0.082; // Constante de los gases ideales (atm*L/mol*K)
int main()
{
int opcion;
do
{
cout << "\n MENU" << endl;
cout << " ----------------------------" << endl;
cout << " [1] SUMA DE N NUMEROS" << endl;
cout << " [2] TABLA DE MULTIPLICAR" << endl;
cout << " [3] CAIDA DE TENSION" << endl;
cout << " [4] LEY DE LOS GASES IDEALES" << endl;
cout << "\n INGRESE UNA OPCION <> 0 : ";
cin >> opcion;
switch (opcion)
{
case 1:
{
cout << "\n SUMA DE N NUMEROS \n";
cout << " ----------------------------" << endl;
int n, suma = 0;
cout << "Ingrese el n-ésimo término a sumar: ";
cin >> n;
for (int i = 1; i <= n; i++)
{
suma += i;
}
cout << "La suma de los " << n << " términos es: " << suma << endl;
break;
}
case 2:
{
cout << "\n TABLA DE MULTIPLICAR \n";
cout << " ---------------------- \n";
for (int i = 1; i <= 12; i++)
{
cout << "\n LA TABLA DEL " << i << endl;
cout << " ---------------------- \n";
for (int j = 1; j <= 12; j++)
{
cout << " " << j << " * " << i << " = " << i * j << endl;
}
}
cout << endl;
break;
}
case 3:
{
cout << "\n CAIDA DE TENSION \n";
cout << "---------------------- \n";
float rho = 0.0175; // Resistividad (ohm*mm^2/m)
int longitud = 20; // Longitud del conductor (m)
for (float corriente = 10; corriente <= 30; corriente += 2)
{
cout << "\n Para una corriente de: " << corriente << " A" << endl;
cout << " ------------------------------ \n";
for (float seccion = 2.5; seccion <= 10; seccion += 0.5)
{
float caida = (rho * corriente * longitud * 0.85) / seccion;
cout << " La caida de tensión para una corriente de " << corriente << " A y una sección de " << seccion << " mm^2 es: " << caida << " V" << endl;
}
}
break;
}
case 4:
{
cout << "\n LEY DE LOS GASES IDEALES \n";
cout << "---------------------- \n";
for (float volumen = 10; volumen <= 80; volumen += 10)
{
cout << "\n Para un volumen de: " << volumen << " L" << endl;
cout << " ------------------------------ \n";
for (float temperatura = 323; temperatura <= 523; temperatura += 20)
{
float presion = (R * temperatura) / volumen;
cout << " La presión para un volumen de " << volumen << " L y una temperatura de " << temperatura << " K es: " << presion << " atm" << endl;
}
}
break;
}
}
} while (opcion != 0);
return 0;
}