main(){ int v1[MAX],v2[MAX],v3[MAX]; zerar(v1,v2,v3); for(int i=0;i<MAX;i++) { v3[i]=soma(v1[i],v2[i]); } for(int i=0;i<MAX;i++) { printf("\n%d",v3[i]); } }
int main(){ /*Declaracao de variaveis*/ Caracteristicas time[QUANTIDADEdeTIMES]; int posicao_time; char nome_time1[15], nome_time2[15]; int gols_time1, gols_time2; int i, j; /*Zera os pontos, e os gols de todos os times*/ zerar(time); /*Leitura da matriz*/ for(i = 0; i < 48; i++){ scanf("%s %d x %d %s", nome_time1, &gols_time1, &gols_time2, nome_time2); /*Procura se o maior time digitado ja existe, adcionando-o ao registro se nao *e adicionando o numero de gols levados e feitos */ busca_time(time, nome_time1, &posicao_time); insere_pontuacao(time, posicao_time, gols_time1, gols_time2); /*Faz o mesmo que foi feito ao time 1 ao time 2 */ busca_time(time, nome_time2, &posicao_time); insere_pontuacao(time, posicao_time, gols_time2, gols_time1); } for(i = 0; i < 32 ; i = i+4){ ordenacao(time, i); } /*Impressao da matriz ordenada com os grupos*/ for(i = 0; i < 8; i++, j = 0){ printf("Grupo %c:\n", time[4*i + j].grupo); for(j = 0; j < 4; j++){ printf("%-15s %3d %3d %3d %3d\n", time[4*i + j].nome, time[4*i + j].pontos, time[4*i + j].gols_feitos, time[4*i + j].gols_tomados, time[4*i + j].saldo_gols); } printf("\n"); } /*Impressao dos jogos da 8 de final*/ printf("Oitavas de final:\n"); for(i = 0; i < 32;i = i+8){ printf("%15s x %s\n", time[i].nome, time[i+5].nome); printf("%15s x %s\n", time[i+4].nome, time[i+1].nome); } return 0; }
void ativar_sensorB() { set_bit(EIMSK, INT1); clr_bit(EIMSK, INT0); zerar(); sensor_ativo = 'B'; }
void ativar_sensorA() { clr_bit(EIMSK, INT1); set_bit(EIMSK, INT0); zerar(); sensor_ativo = 'A'; }