Jump to content



Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.