#include <stdio.h>
#include <stdlib.h>
#define TAM 2
typedef struct
{
char nome[ 20 ] ;
char tipo[ 15 ] ;
int integrantes, posicao;
} BANDAS[ TAM] ;
void ler ( BANDAS * banda) ;
void mostrar ( BANDAS banda) ;
int main( )
{
BANDAS banda;
ler ( & banda) ;
mostrar( banda) ;
return 0 ;
}
void ler ( BANDAS * banda)
{
int i;
for ( i= 0 ; i< TAM; i++ )
{
printf ( "Diga qual o nome da banda: " ) ; printf ( "Quantos integrantes tem a banda: " ) ; scanf ( "%d" ,& ( * banda
) [ i
] .
integrantes ) ; printf ( "Posicao no seu top 5: " ) ; scanf ( "%d" ,& ( * banda
) [ i
] .
posicao ) ; }
}
void mostrar ( BANDAS banda)
{
int i;
for ( i= 0 ; i< TAM; i++ )
{
printf ( "Nome: %s\n " , banda
[ i
] .
nome ) ; printf ( "Tipo de musica: %s\n " , banda
[ i
] .
tipo ) ; printf ( "Numero de integrantes: %d \n " , banda
[ i
] .
integrantes ) ; printf ( "Posicao no seu TOP 5: %d \n " , banda
[ i
] .
posicao ) ; }
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCiNkZWZpbmUgVEFNIDIKCnR5cGVkZWYgc3RydWN0CnsKICAgIGNoYXIgbm9tZVsyMF07CiAgICBjaGFyIHRpcG9bMTVdOwogICAgaW50IGludGVncmFudGVzLHBvc2ljYW87Cn0gQkFOREFTW1RBTV07Cgp2b2lkIGxlciAoQkFOREFTICpiYW5kYSk7CnZvaWQgbW9zdHJhciAoQkFOREFTIGJhbmRhKTsKIAppbnQgbWFpbigpCnsKICAgIEJBTkRBUyBiYW5kYTsKICAgIGxlciAoJmJhbmRhKTsKICAgIHByaW50ZigiXG5cblxuIik7CiAgICBtb3N0cmFyKGJhbmRhKTsKICAgIGdldGNoYXIoKTsKICAgIHJldHVybiAwOwp9Cgp2b2lkIGxlciAoQkFOREFTICpiYW5kYSkKewogICAgaW50IGk7CiAgICBmb3IgKGk9MD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