PROBLEMA 1
GARCIA GAETA
FRNACISCO ARMANDO NO. CONTROL: 11211033
ESCROBIR UN
PROGRAMA INTERACTIVO PARA PROCESAR LAS NOTAS DE UN GRUPO DE
ESTUDIANTES
DE UN CURSO DE PROGRAMACION ENPEZA ESPECIFICANDO EL NUMERO DE NOTAS
DE EXAMEN
PARA CADA ESTUDIANTE. DESPUES INTRODUCIR EL NOMBRE DE CADA ESTUDIANTE
Y LAS NOTAS
DE LOS EXAMENES. CALCULAR UNA MEDIA PARA CADA ESTUDIANTE Y UNA MEDIA
GENERAL DE
LA CLASE. IMPRIMIR EL NOMBRE DEL ESTUDIANTE LAS NOTAS INDIVIDUALES
DE LOS
EXAMENES Y LA MEDIA PARA CADA ESTUDIANTE Y AL FINAL LA MEDIA DE LA CLASE.
Pseudocodigo:
1. Inicio
template <class T>
void IntroducirDatos(T
Arreglo[20][5], int N, int M, char Name[20][30])
template <class T>
void CalcularPromedio(T
Arreglo[20][5], int N, int M, char Name[20][30], real promedioG[20])
void DesplegarDatos(int
Areglo[20][5], int N, int M, char Name[20][30], real promedioG[20])
void MayorPromedio(int N, char
Name[20][30], real promedioG[20])
void main()
{int Arreglo[20][5]
int
N, M
char Name[20][30]
real pG[20]
Print , "Ingresar
el numero de alumnos del grupo:"
Read N
Print , "Ingresar
el numero de calificaciones por alumno:"
Read M
Print , "\n"
,
IntroducirDatos(Arreglo, N,
M, Name)
Print , "\n"
,
CalcularPromedio(Arreglo, N,
M, Name, pG)
Print , "\n"
,
DesplegarDatos(Arreglo,
N, M, Name, pG)
Print , "\n"
,
MayorPromedio(N, Name, pG)
Fin main
void IntroducirDatos(T
Arreglo[20][5], int N, int M, char Name[20][30])
{ int R, C
Print , "Introducir
Datos" ,
for(R=0 R<N
R++)
{ Print , "Nombre
Alumno" , (R+1) , ":"
Read
(Name[R])
for(C=0 C<M
C++)
{ Print , "Calificacion"
, (C+1) , "="
Read Arreglo[R][C] }}}
template <class T>
void CalcularPromedio(T
Arreglo[20][5], int N, int M, char Name[20][30], real promedioG[20])
{ int R, C
real suma=0
for(R=0 R<N
R++)
{ suma=0
Name[R]
for(C=0 C<M
C++)
{suma=suma+Arreglo[R][C] }
promedioG[R]=suma/M }
}
void
DesplegarDatos(int Arreglo[20][5], int N, int M, char Name[20][30], real promedioG[20])
{ int R, C
Print , "
Nombre "
for(C=0 C<M
C++){Print
, " C" , (C+1) , " "
}
Print , " Media estudiante" ,
for(R=0 R<N
R++){
Print , "
" , Name[R] , setw(8)
for(C=0 C<M
C++){Print
, setw(2) , Arreglo[R][C] , setw(6) }
Print , setw(18)
, promedioG[R] , }}
void MayorPromedio(int N, char
Name[20][30], real promedioG[20])
{ int R, mayor
real mayorp=0, pc=0
for(R=0 R<N
R++)
{ pc=pc+promedioG[R]/N
if(promedioG[R]>mayorp)
{mayorp=promedioG[R]
mayor=R }}
Print , "La
media de clase fue : " , pc ,
Print , "El
mayor promedio lo obtubo: " , Name[mayor] ,
Print , "Su
promedio fue: " , mayorp , }
Problema 2
FRANCISCO
ARMANDO GARCIA GAETA NO.CONTROL: 11211033
HAGA UN
PROGRAMA QUE CONSIDERE UN ARREGLO BIDIMENSIONAL CUADRDO DE 4X4 DE NUMEROS
ENTEROS.
REALIZAR LAS SIGUIENTES FUNCIONES:
A) GENERAR
NUMEROS ALEATORIOS PARA ELL ARREGLO BIDIMENCIONAL DE 4X4.
B) UNA
FUNCION PARA SUMAR LAS COLLUMNAS Y DESPLEGAR CADA SUMA.
C) UNA
FUNCION PARA SUMAS LOS RENGLONES Y DESPLEGAR CADA SUMA.
D) UNA
FUNCION PARA SUMAR LA DIAGONAL PRINCIPAL.
E) UNA
FUNCION PARA SUMAR LA DIAGONAL INVERSA.
F) UNA
FUNCION PARA DESPLEGAR TODO EL ARREGLO BIDIMENCIONAL.
Pseudocodigo:
1.
Inicio.
int
IntroducirDatos(int Arreglo[4][4])
void
Sumacolumnas(int Arreglo[4][4])
void
SumaRenglones(int Arreglo[4][4])
void
DesplegarArreglo(int Arreglo[4][4])
void SumaDiagonar(int Arreglo[4][4])
void SumaDiagonalInv(int
Arreglo[4][4])
int main()
{int
Arreglo[4][4]
IntroducirDatos(Arreglo)
DesplegarArreglo(Arreglo)
Print , "\n"
,
Sumacolumnas(Arreglo)
Print , "\n"
,
SumaRenglones(Arreglo)
Print , "\n"
,
SumaDiagonar(Arreglo)
Print , "\n"
,
SumaDiagonalInv(Arreglo)
Fin main
int IntroducirDatos(int
Arreglo[4][4])
{ int R, C
randomize()
{ for(C=0 C<4
C++)
{
Arreglo[R][C]=random(100)+1 }}
return
Arreglo[R][C] }
void
DesplegarArreglo(int Arreglo[4][4])
{int R, C
Print , "
C1 C2 C3
C4" ,
for(R=0 R<4
R++)
{ for(C=0 C<4
C++)
{Print , " " , Arreglo[R][C] , setw(4) }
Print , }}
void Sumacolumnas(int Arreglo[4][4])
{ int R, C,
CA=0
Print , "Suma de columnas" ,
for(C=0 C<4
C++)
{ CA=0
for(R=0 R<4
R++)
{CA=CA+Arreglo[R][C] }
Print , "Colmna
" , (C+1) , "= " , CA , }}
void SumaRenglones(int
Arreglo[4][4])
{ int R, C, RE=0
Print , "Suma
de renglones" ,
for(R=0 R<4
R++)
{RE=0
for(C=0 C<4
C++)
{ RE=RE+Arreglo[R][C] }
Print , "Renglon
" , (R+1) , "= " , RE , }}
void SumaDiagonar(int Arreglo[4][4])
{ int R, D=0
for(R=0 R<4
R++)
{D=D+Arreglo[R][R] }
Print , "Suma
Diagonal= " , D , }
void SumaDiagonalInv(int
Arreglo[4][4])
{ int R, C, DI=0
C=3
for(R=0 R<4
R++)
{DI=DI+Arreglo[R][C] }
C--
Print , "Suma
Diagonal inversa= " , DI , }
Problema 3
GARCIA GAETA FRNACISCO ARMANDO NO.CONTROL:
11211033
UNA COMPAÑIA MANUFACTURERA TIENEN 12 PLANTAS
ELABORAR UN PROGRAMA QUE PERMITA
LEER EL NOMBRE DE CADA PLANTA Y LA PRODUCCION
EN CADA UNO DE LOS 7 DIAS DE LA
SEMANA. UTILIZAR UNA ARREGLO0 DEUNA DIIMENSION
PARA LEER LOS NOMBRES DE LAS
PLANTAS Y UNO DE DOS DIMENSIONES PARA LEER LA
PRODUCCION DE LAS 12 PLANTAS EN
LOS 7 DIAS UNA COLUMNA PARA CADA DIA. LA IDEA
ES LEER EL NOMBRE DE LA PRIMERA
PLANTA Y LUEGO LA PRODUCCION EN CADA UNO DE
LOS 7 DIAS DE LA SEMAN LUGO
PROCESAR EL 2,3 Y ASI SUCESIVAMENTE.
IMPRIMA EL SIGUIENTE REPORTE:
PRODUCCION
PLANTA DIA1 DIA2
DIA3 DIA4 DIA5
DIA6 DIA7 SEMANAL
.
.
.
TOTALES:
PLANTA MAS
PRODUCTIVA:
PRODUCCION
DE LA PLANTA MAS PRODUCTIVA:
DIA DE MAYOR
PRODUCCION:
MAYOR
PRODUCCION EN UN DIA:
Pseudocodigo:
1. Inicio.
int DatosProduccion(int
Produccion[10][7], char NameE[10][30])
void SumarProduccionSemanal(int
Produccion[10][7], int PS[10])
void SumarProduccionDia(int
Produccion[10][7], int PD[7])
void PlantaMayorProduccion(int
Produccion[10][7], int & Mayor, int & PosMayor)
void DesplegarDatos(int
Produccion[10][7], char NameE[10][30], int PS[10], int PD[7])
void DiaMayorPoduccion(int
Produccion[10][7], int & Dia, int & MPD)
int main()
{ int P[10][7], M, PM, PS[10],
PD[7], Dia, MPD
char
N[10][30]
Print "Ingresar
Datos de las Empresas",
DatosProduccion(P,
N)
SumarProduccionDia(P,
PD)
DesplegarDatos(P,
N, PS, PD)
PlantaMayorProduccion(P,
M, PM)
DiaMayorPoduccion(P,
Dia, MPD)
Print "Planta
mas productiva:", N[PM],
Print "Produccion
de la Planta mas Productiva:", M,
Print "Dia
con mayor produccion:", Dia,
Print "Mayor
produccion en un dia:", MPD,
getch(); }
int DatosProduccion(int Produccion[10][7],
char NameE[10][30])
{ ramdomize();
int R, C
for(R=0 R<10 R=R+1)
{ Print "Nombre de la Empresa ", (R+1),
":"
gets(NameE[30])
for( C=0 C<7 C=C+1)
{ Produccion[R][C]=rand(5000)+1 }}
return Produccion[R][C] }
void SumarProduccionSemanal(int
Produccion[10][7], int PS[10])
{ int R, C, suma=0
for(R=0 R<10 R=R+1)
{ suma=0
for( C=0 C<7 C=C+1)
{ suma=suma+Produccion[R][C] }
PS[R]=suma
}}
void SumarProduccionDia(int Produccion[10][7],
int PD[7])
{ int R, C, suma=0
for( C=0 C<7 C=C+1)
{ suma=0
for(R=0 R<10 R=R+1)
{ suma=suma+Produccion[R][C] }
PD[C]=suma }}
void DiaMayorPoduccion(int Produccion[10][7],
int & Dia, int & MPD)
{int C
Dia=0
MPD=0
for(C=0 C<7 C++)
{ if(Produccion[10][C]>Dia)
{
Dia=Produccion[10][C] }
MPD=C
}}
void PlantaMayorProduccion(int Produccion[10][7], int & Mayor, int
& PosMayor)
{ int R
Mayor=0
PosMayor=0
for(R=0 R<10 R=R+1)
{ if(Produccion[R][7]>Mayor)
{ Mayor=Produccion[R][7] }
PosMayor=R
}}
void DesplegarDatos(int Produccion[10][7],
char NameE[10][30], int PS[10], int PD[7])
{ int R, C
Print " Planta Dia1 Dia2
Dia3 Dia4 Dia5
Dia6 Dia7 Prod.Semanal",
for(R=0 R<10 R=R+1)
{Print NameE[R] for( C=0 C<7 C=C+1){Print setw(15), Produccion[R][C], setw(3)
}Print " ", PS[R], }
Print "Totales:", setw(15)
for(C=0 C<7 C++){Print PD[C], setw(3)
}}





No hay comentarios:
Publicar un comentario