-
-
Save parzibyte/9ca74a6fc17c8e7d64131b0e12fdedce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void imprimir(float matriz[CANTIDAD_ALUMNOS][CANTIDAD_MATERIAS + 1], char alumnos[CANTIDAD_ALUMNOS][MAXIMA_LONGITUD_CADENA]) | |
{ | |
int y, x; | |
float promedioMayor = matriz[0][CANTIDAD_MATERIAS]; | |
float promedioMenor = matriz[0][CANTIDAD_MATERIAS]; | |
char alumnoPromedioMayor[MAXIMA_LONGITUD_CADENA]; | |
char alumnoPromedioMenor[MAXIMA_LONGITUD_CADENA]; | |
memcpy(alumnoPromedioMayor, alumnos[0], MAXIMA_LONGITUD_CADENA); | |
memcpy(alumnoPromedioMenor, alumnos[0], MAXIMA_LONGITUD_CADENA); | |
imprimirLinea(); | |
printf("| Alumno |"); | |
for (x = 0; x < CANTIDAD_MATERIAS; x++) | |
{ | |
printf("Cal %d |", x + 1); | |
} | |
printf("Promedio|\n"); | |
imprimirLinea(); | |
for (y = 0; y < CANTIDAD_ALUMNOS; y++) | |
{ | |
printf("|%-10s|", alumnos[y]); | |
float suma = 0; | |
for (x = 0; x < CANTIDAD_MATERIAS; x++) | |
{ | |
int calificacion = matriz[y][x]; | |
printf("%-7d |", calificacion); | |
} | |
float promedio = matriz[y][CANTIDAD_MATERIAS]; | |
if (promedio > promedioMayor) | |
{ | |
promedioMayor = promedio; | |
memcpy(alumnoPromedioMayor, alumnos[y], MAXIMA_LONGITUD_CADENA); | |
} | |
if (promedio < promedioMenor) | |
{ | |
promedioMenor = promedio; | |
memcpy(alumnoPromedioMenor, alumnos[y], MAXIMA_LONGITUD_CADENA); | |
} | |
printf("%0.2f |\n", promedio); | |
imprimirLinea(); | |
} | |
printf("Promedio mayor: %s con %0.2f\n", alumnoPromedioMayor, promedioMayor); | |
printf("Promedio menor: %s con %0.2f\n", alumnoPromedioMenor, promedioMenor); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment