Created
April 9, 2020 14:08
-
-
Save mekhti11/1cc65d48706b54db8a8931d699a94b0c to your computer and use it in GitHub Desktop.
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
#include<stdio.h> | |
#include<stdlib.h> | |
void warn(){ | |
printf("Warning\n"); | |
} | |
void activate_buzzers(){ | |
printf("activating buzzers...\n"); | |
} | |
void close_doors(){ | |
printf("closing doors...\n"); | |
} | |
void start_extinguish(){ | |
printf("starting extiguish...\n"); | |
} | |
void evacuation_procedure(){ | |
printf("evacuation_procedure\n"); | |
} | |
void cut_electricity(){ | |
printf("cut_electricity\n"); | |
} | |
void kill_server(){ | |
printf("kill_server\n"); | |
} | |
void deactivate(){ | |
printf("deactivate_system\n"); | |
} | |
int main(){ | |
/* | |
0 : false | |
1 : true | |
*/ | |
int haraket_s; | |
/* | |
0 : false | |
1 : true | |
*/ | |
int alev_s; | |
int sicaklik; | |
/* | |
0 : false | |
1 : true | |
*/ | |
int isik_s; | |
/* | |
0 : false | |
1 : true | |
*/ | |
int gaz_s; | |
/* | |
0 : false | |
1 : true | |
*/ | |
int kill_switch; | |
printf("0 : False\n1 : True\n\n"); | |
printf("Haraket Sensoru => "); | |
scanf("%d",&haraket_s); | |
printf("Alev Sensoru => "); | |
scanf("%d",&alev_s); | |
printf("Sicaklik => "); | |
scanf("%d",&sicaklik); | |
printf("Isik Sensoru => "); | |
scanf("%d",&isik_s); | |
printf("Gaz Sensoru => "); | |
scanf("%d",&gaz_s); | |
printf("Kill Switch => "); | |
scanf("%d",&kill_switch); | |
if (alev_s){ | |
if (haraket_s){ | |
warn(); | |
activate_buzzers(); | |
close_doors(); | |
}else{ | |
warn(); | |
activate_buzzers(); | |
close_doors(); | |
start_extinguish(); | |
} | |
} | |
else if(gaz_s){ | |
if (alev_s || haraket_s){ | |
warn(); | |
activate_buzzers(); | |
evacuation_procedure(); | |
}else{ | |
warn(); | |
} | |
} | |
else if(sicaklik>23){ | |
if (sicaklik > 28){ | |
cut_electricity(); | |
} | |
else{ | |
warn(); | |
} | |
} | |
else if(isik_s){ | |
warn(); | |
} | |
else if(haraket_s){ | |
if (haraket_s){ // 3 tekrar haraket var mi (3 ne anlamadim sadece haraket sensoru kontrolu yaptim) | |
if (haraket_s || alev_s){ // 5 tekrar haraket var mi (5 ne anlamadim sadece haraket sensoru kontrolu yaptim) | |
kill_server(); | |
} | |
else{ | |
warn(); | |
activate_buzzers(); | |
evacuation_procedure(); | |
} | |
} | |
else{ | |
warn(); | |
} | |
} | |
else if (kill_switch){ | |
deactivate(); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment