miércoles, 16 de mayo de 2012

Practica 14 Unidad 3

Problema 1 

/* Practica 14 problema 1
Hector Leyva Serrano 11211542 */
Codigo en C++
# include <iostream.h>
# include <conio.h>
# include <stdlib.h>
# include <time.h>
# include <iomanip.h>
# include <stdio.h>
void limpiartabla(int produccion[10][12])
{ int r,c;
for (r=0; r<10; r++)
{ for (c=0; c<12; c++)
{ produccion[r][c]=0;
}}}
void insertadatosdeproduccion(int produccion[10][12], int n, char nombres[10][20])
{ int r,c;
cout<<" Nombre trabajador "<<n<<"= ";
gets (nombres[n-1]);
srand(time(NULL));
for (r=0; r<10; r++)
{ for (c=0; c<12; c++)
{ produccion[r][c]=rand()%100+1;
}}}
template <class t>
 void despliegatabla (t produccion[10][12])
{ int r,c;
const int reng=10;
const int colm=12;
for (r=0; r<reng; r++)
{ for (c=0; c<colm; c++)
{ produccion[r][c];
cout <<setw (4)<<produccion[r][c];
} cout<<endl; }}
int calcularpromedio(int produccion[10][12])
{ int suma=0;
int r,c;
for (r=0; r<10; r++)
{ for (c=0; c<12; c++)
{ suma=suma+produccion[r][c];
}} return suma/120; }
void desplegarreporte( int produccion[10][12], char nombres[10][20])
{ int r,c;
int suma;
int promedio;
promedio=calcularpromedio(produccion);
cout <<" Analisis de la produccion"<<endl;
cout <<" Nombre         Total de la produccion"<<endl;
for (r=0; r<10; r++)
{ suma=0;
for (c=0; c<12; c++)
{ suma=suma+produccion[r][c];
} if (suma/12>promedio)
{ cout<< nombres[r]<<" \t\t\t "<<suma/12<<endl;
}} cout <<" Promedio de la  produccion = "<<promedio<<endl;
}
int main ()
{ int n;
char nombres[10][20];
int produccion[10][12];
limpiartabla(produccion);
for (n=1; n<=10; n++)
{ insertadatosdeproduccion(produccion,n,nombres);
} despliegatabla(produccion);
cout<<endl;
desplegarreporte(produccion,nombres);
getch(); }
Seudocodigo

void limpiartabla(int produccion[10][12])
{ r,c int
for (r=0; r<10; r++)
{ for (c=0; c<12; c++)
{ produccion[r][c]=0
}}}
void insertadatosdeproduccion(int produccion[10][12], int n, char nombres[10][20])
{ r,c int
print " Nombre trabajador ",n,"= "
gets (nombres[n-1])
srand(time(NULL))
for (r=0; r<10; r++)
{ for (c=0; c<12; c++)
{ produccion[r][c]=rand()%100+1
}}}
template <class t>
 void despliegatabla (t produccion[10][12])
{ r,c int
const int reng=10
const int colm=12
for (r=0; r<reng; r++)
{ for (c=0; c<colm; c++)
{ produccion[r][c]
print setw (4),produccion[r][c]
}}}
int calcularpromedio(int produccion[10][12])
{ suma=0 int
r,c int
for (r=0; r<10; r++)
{ for (c=0; c<12; c++)
{ suma=suma+produccion[r][c]
}} return suma/120 }
void desplegarreporte( int produccion[10][12], char nombres[10][20])
{ r,c int
suma int
promedio int
promedio=calcularpromedio(produccion)
print " Analisis de la produccion"
print " Nombre         Total de la produccion"
for (r=0; r<10; r++)
{ suma=0
for (c=0; c<12; c++)
{ suma=suma+produccion[r][c]
} if (suma/12>promedio)
{ print nombres[r]," \t\t\t ",suma/12
}} print " Promedio de la  produccion = ",promedio}
Inicio de programa
n int
char nombres[10][20]
int produccion[10][12]
limpiartabla(produccion)
for (n=1; n<=10; n++)
{ insertadatosdeproduccion(produccion,n,nombres);
} despliegatabla(produccion)
desplegarreporte(produccion,nombres)
Fin de programa
Problema 2
/* practica 14 problema 2
Hector Leyva Serrano  11211542 */
Codigo en C++
# include <iostream.h>
# include <conio.h>
# include <iomanip.h>
# include <stdio.h>
# include <stdlib.h>
# include <time.h>
void limpiartabla(int produccion[10][30])
{ int r,c;
for (r=0; r<10; r++)
{ for (c=0; c<30; c++)
{ produccion[r][c]=0;
}}}
void insertadatosdeproduccion(int produccion[10][30], int n, char nombres[10][10])
{ int r,c;
cout<<" Nombre trabajador "<<n<<"=";
gets (nombres[n-1]);
srand(time(NULL));
for (r=0; r<10; r++)
{ for (c=0; c<30; c++)
{ produccion[r][c]=rand()%10+1;
}}}
 void despliegatabla (int produccion[10][30])
{ int r,c;
cout<<"\t\t Datos de la produccion"<<endl;
for (r=0; r<10; r++)
{ for (c=0; c<30; c++)
{ produccion[r][c];
cout<< setw(2) <<(produccion[r][c]);
} cout<<endl; }}
int calcularproduccion(int produccion[10][30])
{ int suma=0;
int c,r;
for(c=0;c<30;c++)
{ suma+= produccion[r][c];
} return suma; }
void desplegarreporte( int produccion[10][30],char nombres[10][10])
{ int r,c;
int suma;
int promedio;
promedio=calcularproduccion(produccion)/30;
cout <<" Reporte mensual de la produccion"<<endl;
cout <<" Nombre          Prod.mes        Prom. Diario         Dias arriba prom. "<<endl;
for (r=0; r<10; r++)
{ cout<<nombres[r]<<"\t\t"<<calcularproduccion(produccion)<<"\t\t   "<<promedio<<endl;
}}
int main ()
{ int n;
char nombres[10][10];
int produccion[10][30];
limpiartabla(produccion);
for (n=1; n<=10; n++)
{ insertadatosdeproduccion(produccion,n,nombres);
} despliegatabla(produccion);
cout<<endl;
desplegarreporte(produccion,nombres);
getch(); }
Seudocodigo 

void limpiartabla(int produccion[10][30])
{ r,c int 
for (r=0; r<10; r++)
{ for (c=0; c<30; c++)
{ produccion[r][c]=0
}}}
void insertadatosdeproduccion(int produccion[10][30], int n, char nombres[10][10])
{ r,c int 
print " Nombre trabajador ",n,"="
gets (nombres[n-1])
srand(time(NULL))
for (r=0; r<10; r++)
{ for (c=0; c<30; c++)
{ produccion[r][c]=rand()%10+1
}}}
 void despliegatabla (int produccion[10][30])
{ r,c int 
print "\t\t Datos de la produccion"
for (r=0; r<10; r++)
{ for (c=0; c<30; c++)
{ produccion[r][c]
print setw(2) ,(produccion[r][c])
}}}
int calcularproduccion(int produccion[10][30])
{ suma=0 int 
 c,r int 
for(c=0;c<30;c++)
{ suma+= produccion[r][c]
} return suma }
void desplegarreporte( int produccion[10][30],char nombres[10][10])
{ r,suma,c int 
promedio int 
promedio=calcularproduccion(produccion)/30
print " Reporte mensual de la produccion"
print " Nombre          Prod.mes        Prom. Diario         Dias arriba prom. "
for (r=0; r<10; r++)
{ print nombres[r],"\t\t",calcularproduccion(produccion),"\t\t   ",promedio
}}
Inicio de programa 
{  n int
char nombres[10][10]
int produccion[10][30]
limpiartabla(produccion)
for (n=1; n<=10; n++)
{ insertadatosdeproduccion(produccion,n,nombres)
} despliegatabla(produccion)
desplegarreporte(produccion,nombres)
Fin de semana
Problema 3 
 /* practica 14 problema 3
Hector Leyva 11211542 */
Codigo en C++
# include <iostream.h>
# include <conio.h>
# include <iomanip.h>
# include <stdio.h>
# include <stdlib.h>
# include <time.h>
 void limpiartabla(int produccion[10][12])
{ int r,c;
const int reng=10;
const int colm=12;
for (r=0; r<reng; r++)
{ for (c=0; c<colm; c++)
{ produccion[r][c]=0;
}}}
void insertadatosdeproduccion(int produccion[10][12], int n, char nombres[10][10])
{ int r,c;
const int reng=10;
const int colm=12;
cout<<" nombre trabajador "<<n<<"=";
gets (nombres[n-1]);
srand(time(NULL));
for (r=0; r<reng; r++)
{ for (c=0; c<colm; c++)
{ produccion[r][c]=rand()%10+1;
}}}
template <class t>
void despliegatabla (t produccion[10][12])
{ int r,c;
const int reng=10;
const int colm=12;
cout<<"\t\t datos dela produccion"<<endl;
for (r=0; r<reng; r++)
{ for (c=0; c<colm; c++)
{ produccion[r][c];
cout <<setw (4)<<produccion[r][c];
} cout<<endl; }}
void desplegarreporte(int produccion[10][12])
{ int r,c,suma,total;
const int reng=10;
const int colm=12;
cout<<" \n\t analisis de la produccion \n";
for(r=0; r<reng; r++)
{ suma++;
for (c=0; c<colm; c++)
{ suma=suma+produccion[r][c];
}}
cout<<"total dela produccion es ="<<suma<<endl;
for (r=0; r<reng; r++)
{ suma=0;
for(c=0; c<colm; c++)
{ suma=suma+produccion[r][c];
}}
cout<<"cantidad producida en la estacion mas producctiva = "<<suma; }
int main ()
{ int n;
char nombres[10][10];
int produccion[10][12];
limpiartabla(produccion);
for (n=1; n<=10; n++)
{ insertadatosdeproduccion(produccion,n,nombres);
} despliegatabla(produccion);
cout<<endl;
desplegarreporte(produccion);
getch(); }
Seudocodigo

 void limpiartabla(int produccion[10][12])
{ r,c int 
const int reng=10
const int colm=12
for (r=0; r<reng; r++)
{ for (c=0; c<colm; c++)
{ produccion[r][c]=0
}}}
void insertadatosdeproduccion(int produccion[10][12], int n, char nombres[10][10])
{ r,c int
const int reng=10
const int colm=12
print " nombre trabajador ",n,"="
gets (nombres[n-1])
srand(time(NULL))
for (r=0; r<reng; r++)
{ for (c=0; c<colm; c++)
{ produccion[r][c]=rand()%10+1
}}}
template <class t>
void despliegatabla (t produccion[10][12])
{ r,c int
const int reng=10
const int colm=12
print "\t\t datos dela produccion"
for (r=0; r<reng; r++)
{ for (c=0; c<colm; c++)
{ produccion[r][c]
print setw (4),produccion[r][c]
}}}
void desplegarreporte(int produccion[10][12])
{ r,c,suma,total int
const int reng=10
const int colm=12
print " \n\t analisis de la produccion \n"
for(r=0; r<reng; r++)
{ suma++
for (c=0; c<colm; c++)
{ suma=suma+produccion[r][c]
}}
print "total dela produccion es =",suma
for (r=0; r<reng; r++)
{ suma=0
for(c=0; c<colm; c++)
{ suma=suma+produccion[r][c]
}}
Print "cantidad producida en la estacion mas producctiva = ",suma }
Inicio de programa
{ n int
char nombres[10][10]
int produccion[10][12]
limpiartabla(produccion)
for (n=1; n<=10; n++)
{ insertadatosdeproduccion(produccion,n,nombres)
} despliegatabla(produccion)
desplegarreporte(produccion)
Fin de programa

No hay comentarios:

Publicar un comentario