/*
https://www.clubedohardware.com.br/profile/1154506-avss/
https://www.clubedohardware.com.br/topic/1539587-n%C3%A3o-consigo-resolver-exerc%C3%ADcio-em-linguagem-c/
Alguém Poderia me ajudar a resolver esse exercício em C.
Solicitar ao usuário os seguintes dados de até 20 alunos
Matrícula Int, positivo, 0= fim
Ano.matrícula Int, >= 2010
Exibir a menor matrícula e quantidade de alunos matriculados após ano 2010
*/
// Dados de ate 20 alunos, matricula int; positivo; ano matricula int >=2010
// Exibir a menor matricula e a quantidade de alunos matriculados apos 2010
#include <stdio.h>
int main( void ){
int _matriculas_codigo_ [20]= {0},
_matriculas_ano_ [20]= {0},
_matriculas_tamanho_= 0;
printf("%s",
"NESTE PROGRAMA DESCOBRE E EXIBE A MENOR MATRICULA E A QUANTIDADE DE MATRICULAS APOS O ANO 2010\n"
"DENTRE ATE 20 MATRICULAS DE ALUNOS\n" );
{
for( int idx= 0; idx < 20; ++idx ){
printf( "INFORME A MATRICULA (0=FIM DOS DADOS)\n" );
{
int codigo= 0;
int flag= scanf( " %d", &codigo );
scanf( "%*[^\n]" );
while( 1 > flag ){
printf( "Matricula Invalida.\n"
"Informe Novamente: " );
flag= scanf( " %d", &codigo );
scanf( "%*[^\n]" );
}
if( 0 == codigo )break;
_matriculas_codigo_ [idx]= codigo; ///adicionar matricula
}
printf( "INFORME O ANO DA MATRICULA (0=FIM DOS DADOS)\n" );
{ int ano= 0;
int flag= scanf( " %d", &ano);
scanf( "%*[^\n]" );
while( (1 > flag)||(2010 > ano) ){
printf( "Ano Invalida.\n"
"Informe Novamente: " );
flag= scanf( " %d", &ano );
scanf( "%*[^\n]" );
}
if( 0 == ano )break;
_matriculas_ano_ [idx]= ano; ///adicionar ano matricula
}
++_matriculas_tamanho_; ///concluir um cadastro
} }
printf( "%s%u%s",
"Excelente! Chegamos ao final do cadastramento...\n"
"O total de ",_matriculas_tamanho_, " matricula(s) cadastrada(s)\n\n" );
///escreva restante <<PROCESSAMENTO>>
} // fim dos dados