#include <stdio.h>
#include <stdlib.h>
#define NUM_NOTAS 5
#define TAM_NOME 20
struct Aluno {
char nome[ TAM_NOME] ;
int numero;
int notas[ NUM_NOTAS] ;
} ;
void preenche( struct Aluno lista[ ] , int tam) {
for ( int i = 0 ; i < tam; i++ ) {
printf ( "\n Nome:" ) ;
scanf ( "%s" , lista[ i] .nome ) ;
printf ( "\n Número:" ) ;
scanf ( "%d" , & lista[ i] .numero ) ;
for ( int j = 0 ; j < NUM_NOTAS; j++ ) {
printf ( "\n Introduza a nota %d:" , j) ;
scanf ( "%d" , & lista[ i] .notas [ j] ) ;
}
}
}
int main( void ) {
struct Aluno lista[ 2 ] ;
preenche( lista, 2 ) ;
printf ( "\n ----------------------" ) ;
for ( int i = 0 ; i < 2 ; i++ ) {
printf ( "\n Nome:" ) ;
printf ( "%s" , lista[ i] .nome ) ;
printf ( "\n Número:" ) ;
printf ( "%d" , lista[ i] .numero ) ;
for ( int j = 0 ; j < NUM_NOTAS; j++ ) {
printf ( "\n Nota %d:" , j) ;
printf ( "%d" , lista[ i] .notas [ j] ) ;
}
}
return ( EXIT_SUCCESS ) ;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCiNkZWZpbmUgTlVNX05PVEFTIDUKI2RlZmluZSBUQU1fTk9NRSAyMAoKc3RydWN0IEFsdW5vIHsKIGNoYXIgbm9tZVtUQU1fTk9NRV07CiBpbnQgbnVtZXJvOwogaW50IG5vdGFzW05VTV9OT1RBU107Cn07Cgp2b2lkIHByZWVuY2hlKHN0cnVjdCBBbHVubyBsaXN0YVtdLCBpbnQgdGFtKSB7Cglmb3IgKGludCBpID0gMDsgaSA8IHRhbTsgaSsrKSB7CgkgICAgcHJpbnRmKCJcbk5vbWU6Iik7CgkgICAgc2NhbmYoIiVzIiwgbGlzdGFbaV0ubm9tZSk7CgkgICAgcHJpbnRmKCJcbk7Dum1lcm86Iik7CgkgICAgc2NhbmYoIiVkIiwgJmxpc3Rh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