PRACTICAS NUMERO 4

INSTITUTO TECNOLÓGICO DE TIJUANA                       MATERIA PROGRAMACIÓN ESTRUCTURADA

ING. ELECTRONICA


CODIFICACION EN C++ Y CORRIDA PRACTICA No 4 PROBLEMA No 1


DIAGRAMA DE FLUJO



CODIGO




CODIFICACION EN C++ Y CORRIDA PRACTICA No 4 PROBLEMA No 2



DIAGRAMA DE FLUJO



CODIGO





CODIFICACION EN C++ Y CORRIDA PRACTICA No 4 PROBLEMA No 3


DIAGRAMA DE FLUJO




CODIGO





CODIFICACION EN C++ Y CORRIDA PRACTICA No 4 PROBLEMA No 4


DIAGRAMA DE FLUJO





CODIGO






CODIFICACION EN C++ Y CORRIDA PRACTICA No 4 PROBLEMA No 5



PSEUDOCODIGO


Inicio
l, m,n, a, b, costo real
write "Terreno A"
write "Medida del lado: "
read l
write " Terreno B"
write "Medida de la base: "
read m
write "Medida de la altura: "<
read n
write "Costo por metro cuadrado: "
read costo
a= l * l
a= a * costo
b= m * n
b= b * costo
if(a<b)
write "El terreno A es mas barato"
else if (b>a)
write "El terreno B es mas barato"
else
write "Los terrenos cuestan igual"
Fin


CODIGO




CODIFICACION EN C++ Y CORRIDA PRACTICA No 4 PROBLEMA No 6


PSEUDOCODIGO



Inicio
descricpcion1 [20], descricpcion2 [20],descricpcion3 [20] char
total, subtotal1, subtotal2, subtotal3, subtotal, precio1, precio2, precio3, descuento real
cantidad1, cantidad2, cantidad3 int


write "Nombre de articulo 1: "
read descripcion1
write "Precio articulo 1: "
read precio1
write "Cantidad articulo 1: "
read cantidad 1
write "Nombre de articulo 2: "
read descripcion2
write "Precio articulo 2: "
read precio2
write "Cantidad articulo 2: "
read cantidad 2
write "Nombre de articulo 3: "
read descripcion3
write "Precio articulo 3: "
read precio3
write "Cantidad articulo 3: "
read cantidad 3
subtotal1 = precio1 * cantidad1
subtotal2 = precio2 * cantidad2
subtotal3 = precio3 * cantidad3
subtotal = subtotal1 + subtotal2 + subtotal3
if(subtotal>10000)
then
descuento = subtotal*0.1
total = subtotal - descuento
else if(subtotal<=10000 and subtotal>4000)
then
descuento = subtotal*0.08
total = subtotal - descuento
else if(subtotal<=4000 and subtotal>2000)
then
descuento = subtotal*0.06
total = subtotal - descuento
else if(subtotal<=2000 and subtotal>1500)
then
descuento = subtotal*0.03
total = subtotal - descuento
else
then
descuento = 0
total = subtotal
write "Articulo: ",descripcion1," , cantidad: ", cantidad1," precio individual: ", precio1
write "Subtotal de ",descripcion1, " = ", subtotal1
write "Articulo: ",descripcion2," , cantidad: ", cantidad2," precio individual: ", precio2
write "Subtotal de ",descripcion2, " = ", subtotal2
write "Articulo: ",descripcion3," , cantidad: ", cantidad3," precio individual: ", precio3
write "Subtotal de ",descripcion3, " = ", subtotal3
write "Descuento de: ", descuento
write "TOTAL: ",total
Fin



CODIGO






CODIFICACION EN C++ Y CORRIDA PRACTICA No 4 PROBLEMA No 7



PSEUDOCODIGO


Inicio
cred int
grado[10] char
write "Introduzca el numero de creditos: "
read cred
if(cred>110)
then
grado = ultimo
else
{
if(cred<=110 and cred>64)
then 
grado = tercer
else
{
if(cred<=64 and cred>48)
then
grado = segundo
else
grado = primero
}
}
write " El estudiante esta en ",grado," grado
Fin


CODIGO






CODIFICACION EN C++ Y CORRIDA PRACTICA No 4 PROBLEMA No 8


PSEUDOCODIGO


Inicio
next = 's' char
while(next = ='s')
{
a,b,c,d, MAYOR, menor int

write "Introduzca 4 numeros ENTEROS distintios entre si: "
write "Numero 1: "
read a
write "Numero 2: "
read b
write "Numero 3: "
read c
"Numero 4: "
read d
if (a!=b and a!=c and a!=d and b!=c and b!=d and c!=d)
then 
{
if (a>d and a>c and a>b)
MAYOR = a


else if(b>a and b>c and b>d)
MAYOR = b


else if(c>a and c>b and c>d)
MAYOR = c


else if(d>a and d>b and d>c)
MAYOR=d


if(a<d and a<c and a<b)
menor = a


else if(a>b and c>b and d>b)
menor = b


else if(c<a and c<b and c<d)
menor = c


else if(d<a and d<b and d<c)
menor=d


write "El dato mayor es ", MAYOR
write "El dato menor es ", menor
}
else
write "Error, Introduzca valores distintos entre si"


write "Desea intentar de nuevo (s/n)"
read next
}
FIN



CODIGO





No hay comentarios:

Publicar un comentario