Ejemplo n.º 1
0
void abate(Gado v[],int n){
   int i=0;
   for(i=0;i<n;i++){
     if(idade(v[i].nasc.ano,v[i].nasc.mes)>5|| v[i].leite<40 || (50<v[i].leite<70 && v[i].alim>=50)){
        strcpy(v[i].abate,"S");
     }else{
     strcpy(v[i].abate,"N");
     }
   }
}
Ejemplo n.º 2
0
int main(int argc, char *argv[]){

	char nome[50];
	struct dia tmp;
	struct dia *d =	checkArgs( &argc, argv );

	FILE *in = fopen( argv[1], "r" );
	FILE *out= fopen( "nomesEidades.txt" , "w");

	
	while( !feof( in ) ){
		fscanf(in,"%[^,],%d %d %d\n", nome, &tmp.dia, &tmp.mes, &tmp.ano);
		printf("n:%s, dia:%d, mes:%d, ano:%d\n",nome,tmp.dia,tmp.mes,tmp.ano);
		fprintf(out,"%s\t%d\n",nome, idade( &tmp, d ) );
	}

	fclose(in);
	fclose(out);
			
}