Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Lado 1
Triangulo Lado 2
Lado3
ANÁLISIS
Se debe determinar los lados de un triangulo con estructura de datos.
DATOS DE ENTRADA
Se debe declarar los tres lados del triángulo.
Utilizar los tipos de dato estructura con la palabra reservada struct
Se debe llamar a la llamada recursiva.
DATOS DE SALIDA
Se debe imprimir para los tres lados.
Se debe realizar las comparaciones.
cuando los tres lados son iguales (equilátero).
cuando los dos lados son iguales y uno distinto (isósceles).
cuando los tres lados son distintos (escaleno).
# include <iostream>
using namespace std;
struct triangulo
{
int l1,l2,l3;
};
struct triangulo t;
void leer();
void proceso();
int main()
{
leer();
proceso();
}
void leer()
{
cout<<"\n\t\t INGRESE EL PRIMER LADO: "; cin>>t.l1;
cout<<"\n\t\t INGRESE EL SEGUNDO LADO: "; cin>>t.l2;
cout<<"\n\t\t INGRESE EL TERCER LADO: "; cin>>t.l3;
if(t.l1<=0 ||t.l2<=0 ||t.l3<=0 )
{
cout<<"\n\t\t ERROR UNO O MAS LADOS NO SON
PERMITIDOS";
cout<<"\n\t\t DEBE INTRODUCIR VALORES POSITIVOS PARA LOS
LADOS DEL TRIANGULO:""\n";
leer(); //llamada recursiva
}
}
void proceso()
{
if(t.l1==t.l2&&t.l1==t.l3&&t.l2==t.l3){
cout<<"\n\t\t __________________________ ";
cout<<"\n\t\t El triangulo es equilatero "; //cuando los tres lados son
iguales
cout<<"\n\t\t __________________________ ";
}
else if(t.l1==t.l2||t.l1==t.l3&&t.l2==t.l3){
cout<<"\n\t\t ________________________ ";
cout<<"\n\t\t El triangulo es isoceles ";//cuando los dos lados son
iguales y uno distinto
cout<<"\n\t\t ________________________ ";
}
else {
cout<<"\n\t\t ________________________ ";
cout<<"\n\t\t El triangulo es escaleno ";//cuando los tres lados son
distintos
cout<<"\n\t\t ________________________ ";
}
}
CAPTURA DE PANTALLA
2. DADA LA SIGUIENTE ESTRUCTURA DE DATOS:
Nombre y apellidos
Haber Básico (Bs. 2445)
Bono Antigüedad: 17.4% del Haber Básico
Empleado Bono de Producción: 26.5% del Haber Básico
Descuento AFP: 10% del Haber Básico
Federación: 0.5% del Haber Básico
Líquido Pagable.
REALIZAR ANÁLISIS E IMPLEMENTAR PROGRAMA C++ FUNCIONAL,
SIN PROTOTIPOS Y VARIABLES GLOBALES PARA CALCULAR EL
TOTAL GANADO, EL TOTAL DE LOS DESCUENTOS Y EL LÍQUIDO
PAGABLE. LUEGO IMPRIMIR LA BOLETA CON TODA LA INFORMACIÓN
PROCESADA. EL HABER BÁSICO DEBE CONTROLARSE, DEBE ESTAR
ENTRE 1800 Y 2500 BS.
ANÁLISIS
Se debe determinar que datos y sentencias utilizara.
DATOS DE ENTRADA
Se debe declarar el tipo de dato estructura con la palabra reservada
struct.
Se debe declarar las variables de tipo estructura:
char nom[30];
int hb;
float boant, boprod, desafp, fede, tg, tdes, lp;
se debe de realizar control al haber básico con la sentencia condicional
if.
DATOS DE SALIDA
Se debe imprimir una boleta con todos con todos los datos utilizados.
#include <iostream>
#include <stdio.h>
struct empleado
{
char nom[30];
int hb;
float boant, boprod, desafp, fede, tg, tdes, lp;
};
void leer()
{
if(em.hb<1800||em.hb>2500)
{
cout<<"\n\tError el haber basico no puede ser menor
a 1800 y mayor a 2500";
cout<<"\n\tIngrese la cantidad en los rangos
establecidos en le mensaje: ";
leer();
}
}
void calcular()
{
void mostrar()
{
int main()
{
leer();
calcular();
mostrar();
}
CAPTURA DE PANTALLA