Whiteangel Posted December 6, 2015 at 04:59 PM Report Share #590419 Posted December 6, 2015 at 04:59 PM Boas pessoal, estou a fazer a contagem de pessoas que fazem anos num determinado mes, o mes vai buscar, mas o numero de pessoas não, podem ajudar? int n; fseek(fich, 0, SEEK_END); n = ftell(fic) / sizeof(a); fseek(fich, 0, SEEK_SET); printf("%d total\n", n); int cont[12]; for (int i = 0; i < 12; i++) { cont[i]= 0; } for (int i = 0; i < n; i++) { fread(&a, sizeof(a), 1, fich); printf("No mes %d \n ", a.data_nascimento.mes); if (a.estado == 'A') { cont[a.data_nascimento.mes - 1]++; }printf("exitem %d.\n \n",cont[i]); Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted December 6, 2015 at 07:58 PM Report Share #590426 Posted December 6, 2015 at 07:58 PM for (int i = 0; i < n; i++) { // o que faz este ciclo ? fread(&a, sizeof(a), 1, fich); printf("No mes %d \n ", a.data_nascimento.mes); // como é que o ciclo está relacionado com este output ? IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now