32 lines
599 B
C
32 lines
599 B
C
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
|
|
int main() {
|
|
printf("Are you sure? [y/N] ");
|
|
char input;
|
|
fgets(&input, 2, stdin);
|
|
printf("Your input was %c\n", input);
|
|
bool response;
|
|
switch(input) {
|
|
case 'y':
|
|
case 'Y':
|
|
response = true;
|
|
break;
|
|
case 'n':
|
|
case 'N':
|
|
response = false;
|
|
break;
|
|
default:
|
|
response = false;
|
|
break;
|
|
}
|
|
|
|
printf("Your response was interpreted as %d\n", response);
|
|
|
|
if (response) {
|
|
return 0;
|
|
} else {
|
|
return 1;
|
|
}
|
|
}
|