-
-
Save Tomcat-42/9995cdfc86b29d3e397e2333c6f9db46 to your computer and use it in GitHub Desktop.
pouso de emergência
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void emergencia() | |
{ | |
int i,j; | |
printf("\nRelatórios de Aterrissagens de emergência:\n\n"); | |
Lnode *aux; | |
for(i=0; i<4; i++) | |
{ | |
aux = fila_aterrissagem[i].First; | |
for(j=0; aux && j<fila_aterrissagem[i].Lenght; j++, aux= aux->Next) | |
{ | |
if(aux->Data.fuel == 2) | |
printf("Avião %d com pouco combustível, aterrissagem emergencial será relizada em breve!\n\n", aux->Data.id); | |
if(aux->Data.fuel == 1) | |
{ | |
printf("Avião %d em situação crítica de combustível!\n", aux->Data.id); | |
if(!pistas_usadas[2]) | |
{ | |
printf("Pista 3 Disponível, realizando pouso de emergência!\n\n"); | |
pistas_usadas[2] = 1; | |
Lremove(&fila_aterrissagem[i], j); | |
} | |
else if(!pistas_usadas[1]) | |
{ | |
printf("Pista 2 Disponível, realizando pouso de emergência!\n\n"); | |
pistas_usadas[1] = 1; | |
Lremove(&fila_aterrissagem[i], j); | |
} | |
else if(!pistas_usadas[0]) | |
{ | |
printf("Pista 1 Disponível, realizando pouso de emergência!\n\n"); | |
pistas_usadas[0] = 1; | |
Lremove(&fila_aterrissagem[i], j); | |
} | |
else | |
{ | |
printf("Nenhuma Pista disponível para aterrissagem, o avião caiu e foram contabilizadas %d mortes\n\n",(rand()%300)+100); | |
Lremove(&fila_aterrissagem[i], j); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment