ESCUELA SUPERIOR POLITÉCNICA DE CHIMBORAZO
CARRERA: INGENIERÍA EN TELEMÁTICA
Nombre: Sofia Cuenca Código: 137
Pao: 1
Problema 1
int main() {
int opcion, cantidad;
int precio = 0;
string nombre_sector;
cout << "SECTORES DISPONIBLES:\n";
cout << "1. Sol general - $3\n";
cout << "2. Sol preferente - $5\n";
cout << "3. Sombra - $8\n";
cout << "4. Tribuna - $15\n";
cout << "5. Platea - $20\n";
cout << "\nSeleccione el numero del sector: ";
cin >> opcion;
switch (opcion) {
case 1:
nombre_sector = "Sol general";
precio = 3;
break;
case 2:
nombre_sector = "Sol preferente";
precio = 5;
break;
case 3:
nombre_sector = "Sombra";
precio = 8;
break;
case 4:
nombre_sector = "Tribuna";
precio = 15;
break;
case 5:
nombre_sector = "Platea";
precio = 20;
break;
default:
cout << "Error: Sector inexistente. Intente con un numero entre 1 y 5." << endl;
}
cout << "Ingrese la cantidad de entradas: ";
cin >> cantidad;
if (cantidad <= 0) {
cout << "Error: La cantidad debe ser mayor que cero." << endl;
return 1;
}
int total = cantidad * precio;
cout << "\nHa seleccionado el sector: " << nombre_sector << endl;
cout << "Cantidad de entradas: " << cantidad << endl;
cout << "Total a pagar: $" << total << endl;
ESCUELA SUPERIOR POLITÉCNICA DE CHIMBORAZO
CARRERA: INGENIERÍA EN TELEMÁTICA
}
Problema 2
#include <stdlib.h>
#include <conio.h>
#include <math.h>
#include <windows.h>
using namespace std;
int main() {
const float PI = 3.14159265;
char g = (char)248;
HANDLE cur;
cur = GetStdHandle(STD_OUTPUT_HANDLE);
COORD p;
float angulo = 0;
char opcion = ' ';
float anguloRadianes = 0;
float resul = 0;
cout << "\t* CALCULADORA FUNCIONES TRIGONOMETRICAS BASICAS *\n";
cout << "\t***********************************************\n";
cout << "\t* Lista de funciones trigonometricas *\n";
cout << "\t* 1 - Seno *\n";
cout << "\t* 2 - Coseno *\n";
cout << "\t* 3 - Tangente *\n";
cout << "\t***********************************************\n";
p.X = 5; p.Y = 10;
SetConsoleCursorPosition(cur, p);
cout << "Selecciona el numero correspondiente a la funcion deseada: ";
p.X = 5; p.Y = 16;
SetConsoleCursorPosition(cur, p);
cout << "RESULTADO: ";
ESCUELA SUPERIOR POLITÉCNICA DE CHIMBORAZO
CARRERA: INGENIERÍA EN TELEMÁTICA
p.X = 65; p.Y = 10;
SetConsoleCursorPosition(cur, p);
opcion = getche();
switch(opcion) {
case '1':
case '2':
case '3':
p.X = 5; p.Y = 13;
SetConsoleCursorPosition(cur, p);
cout << "Ingresa el valor del angulo (en grados sexagesimales): ";
cin >> angulo;
anguloRadianes = angulo * (PI / 180);
p.X = 16; p.Y = 16;
SetConsoleCursorPosition(cur, p);
switch(opcion) {
case '1':
resul = sin(anguloRadianes);
cout << "Seno de " << angulo << g << " es: " << resul;
break;
case '2':
resul = cos(anguloRadianes);
cout << "Coseno de " << angulo << g << " es: " << resul;
break;
case '3':
resul = tan(anguloRadianes);
cout << "Tangente de " << angulo << g << " es: " << resul;
break;
}
break;
default:
p.X = 16; p.Y = 16;
SetConsoleCursorPosition(cur, p);
cout << "\a\aOpcion no valida";
}
cout << "\n\n\n";
system("pause");
}
ESCUELA SUPERIOR POLITÉCNICA DE CHIMBORAZO
CARRERA: INGENIERÍA EN TELEMÁTICA
Problema 3
#include <iostream>
using namespace std;
int main() {
char caracter;
cout << "Ingresa algun caracter : ";
cin >> caracter;
switch (caracter) {
case 'a': case 'A':
case 'e': case 'E':
case 'i': case 'I':
case 'o': case 'O':
case 'u': case 'U':
cout << "Es una vocal ." << endl;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
cout << "Es un digito ." << endl;
break;
default:
cout << "ERROR INGRESE VOCAL O DIGITO . " << endl;
break;
}
}
ESCUELA SUPERIOR POLITÉCNICA DE CHIMBORAZO
CARRERA: INGENIERÍA EN TELEMÁTICA
Problema 4
#include <iostream>
#include <cmath>
#include <windows.h>
#include <conio.h>
using namespace std;
int main() {
const float PI = 3.14159265;
char g = (char)248;
HANDLE cur = GetStdHandle(STD_OUTPUT_HANDLE);
COORD p;
float angulo = 0, anguloRadianes = 0, resul = 0;
char opcion = ' ';
int tipoAngulo = 0;
cout << "\t* CALCULADORA FUNCIONES TRIGONOMETRICAS BASICAS *\n";
cout << "\t*************************************************\n";
cout << "\t* Lista de funciones trigonometricas: *\n";
cout << "\t* 1 - Seno *\n";
cout << "\t* 2 - Coseno *\n";
cout << "\t* 3 - Tangente *\n";
cout << "\t* 4 - Cotangente *\n";
cout << "\t* 5 - Secante *\n";
cout << "\t* 6 - Cosecante *\n";
cout << "\t*************************************************\n";
p.X = 5; p.Y = 10; SetConsoleCursorPosition(cur, p);
cout << "Selecciona la funcion deseada (1-6): ";
p.X = 45; p.Y = 10; SetConsoleCursorPosition(cur, p);
opcion = getche();
p.X = 5; p.Y = 12; SetConsoleCursorPosition(cur, p);
cout << "¿El angulo esta en (1) Grados o (2) Radianes? ";
cin >> tipoAngulo;
ESCUELA SUPERIOR POLITÉCNICA DE CHIMBORAZO
CARRERA: INGENIERÍA EN TELEMÁTICA
p.X = 5; p.Y = 14; SetConsoleCursorPosition(cur, p);
cout << "Ingresa el valor del angulo: ";
cin >> angulo;
anguloRadianes = (tipoAngulo == 1) ? angulo * (PI / 180.0) : angulo;
p.X = 5; p.Y = 16; SetConsoleCursorPosition(cur, p);
cout << "RESULTADO: ";
p.X = 16; p.Y = 16; SetConsoleCursorPosition(cur, p);
switch (opcion) {
case '1':
resul = sin(anguloRadianes);
cout << "Seno de " << angulo << g << " = " << resul;
break;
case '2':
resul = cos(anguloRadianes);
cout << "Coseno de " << angulo << g << " = " << resul;
break;
case '3':
resul = tan(anguloRadianes);
cout << "Tangente de " << angulo << g << " = " << resul;
break;
case '4':
if (tan(anguloRadianes) != 0)
resul = 1 / tan(anguloRadianes);
else
cout << "Cotangente indefinida (tan = 0)";
if (tan(anguloRadianes) != 0)
cout << "Cotangente de " << angulo << g << " = " << resul;
break;
case '5':
if (cos(anguloRadianes) != 0)
resul = 1 / cos(anguloRadianes);
else
cout << "Secante indefinida (cos = 0)";
if (cos(anguloRadianes) != 0)
cout << "Secante de " << angulo << g << " = " << resul;
break;
case '6':
if (sin(anguloRadianes) != 0)
resul = 1 / sin(anguloRadianes);
else
cout << "Cosecante indefinida (sin = 0)";
if (sin(anguloRadianes) != 0)
cout << "Cosecante de " << angulo << g << " = " << resul;
break;
default:
cout << "\a\aOpcion no valida.";
}
cout << "\n\n";
system("pause");
ESCUELA SUPERIOR POLITÉCNICA DE CHIMBORAZO
CARRERA: INGENIERÍA EN TELEMÁTICA
}
Problema 5
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
const float PRECIO_SIN_IVA = 78.0;
const float IVA = 0.16;
float precioConIVA = PRECIO_SIN_IVA * (1 + IVA);
int cantidad;
int opcion;
float totalSinDescuento, descuento, totalFinal;
string formaPago;
cout << "Ingrese la cantidad de impresoras a comprar: ";
cin >> cantidad;
cout << "\nFormas de pago disponibles:\n";
cout << "1. Efectivo (10% de descuento)\n";
cout << "2. Tarjeta de crédito (5% de descuento)\n";
cout << "3. Vale de regalo (15% de descuento)\n";
cout << "Seleccione la opción de forma de pago (1-3): ";
cin >> opcion;
totalSinDescuento = cantidad * precioConIVA;
switch (opcion) {
case 1:
formaPago = "Efectivo";
descuento = totalSinDescuento * 0.10;
break;
case 2:
formaPago = "Tarjeta de crédito";
descuento = totalSinDescuento * 0.05;
ESCUELA SUPERIOR POLITÉCNICA DE CHIMBORAZO
CARRERA: INGENIERÍA EN TELEMÁTICA
break;
case 3:
formaPago = "Vale de regalo";
descuento = totalSinDescuento * 0.15;
break;
default:
cout << "Opción no válida. Se aplicará sin descuento.\n";
formaPago = "Sin descuento";
descuento = 0;
break;
}
totalFinal = totalSinDescuento - descuento;
cout << fixed << setprecision(2);
cout << "\n---------- DETALLE DE COMPRA ----------\n";
cout << "Cantidad de impresoras: " << cantidad << endl;
cout << "Precio unitario con IVA: $" << precioConIVA << endl;
cout << "Total sin descuento: $" << totalSinDescuento << endl;
cout << "Forma de pago: " << formaPago << endl;
cout << "Descuento aplicado: $" << descuento << endl;
cout << "TOTAL A PAGAR: $" << totalFinal << endl;
}
Problema 6
#include <iostream>
using namespace std;
int main() {
char caracter;
cout << "Ingresa algun caracter : ";
cin >> caracter;
switch (caracter) {
case 'a': case 'A':
case 'e': case 'E':
case 'i': case 'I':
ESCUELA SUPERIOR POLITÉCNICA DE CHIMBORAZO
CARRERA: INGENIERÍA EN TELEMÁTICA
case 'o': case 'O':
case 'u': case 'U':
cout << "Es una vocal ." << endl;
break;
case 'b': case 'B':
case 'c' : case'C':
case 'd' : case'D':
case 'g' : case'G':
case 'f' : case'F':
case 'h' : case'H':
case 'j' : case'J':
case 'k' : case'K':
case 'l' : case'L':
case 'm' : case'M':
case 'n' : case'N':
case 'ñ' : case'Ñ':
case 'p' : case 'P':
case 'q' : case'Q':
case 'r' : case'R':
case 's' : case'S':
case 't' : case'T':
case 'v' : case'V':
case 'w' : case'W':
case 'x' : case'X':
case 'y' : case'Y':
case 'z' : case'Z':
cout<<"Es una consonante ."<<endl;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
cout << "Es un digito ." << endl;
break;
default:
cout << "ERROR INGRESE VOCAL O DIGITO . " << endl;
break;
}
}