51 lines
1010 B
C
51 lines
1010 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
void no()
|
|
{
|
|
printf("Nope.\n");
|
|
exit(1);
|
|
}
|
|
|
|
void yes()
|
|
{
|
|
printf("Good job.\n");
|
|
exit(0);
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
char input[24];
|
|
char output[9];
|
|
char char_ascii_in_chars[4];
|
|
int char_ascii = 0;
|
|
int inp_idx = 2;
|
|
int out_idx = 1;
|
|
int len = 0;
|
|
|
|
printf("please enter key: ");
|
|
if (scanf("%23s", input) != 1)
|
|
no();
|
|
if (input[0] != '0' || input[1] != '0')
|
|
no();
|
|
fflush(stdin);
|
|
|
|
memset(output, 0, 9);
|
|
output[0] = 'd';
|
|
char_ascii_in_chars[3] = '\0';
|
|
while (strlen(output) < 8 && inp_idx < strlen(input))
|
|
{
|
|
char_ascii_in_chars[0] = input[inp_idx++];
|
|
char_ascii_in_chars[1] = input[inp_idx++];
|
|
char_ascii_in_chars[2] = input[inp_idx++];
|
|
char_ascii = atoi(char_ascii_in_chars);
|
|
output[out_idx++] = (char)char_ascii;
|
|
}
|
|
output[out_idx] = '\0';
|
|
|
|
if (strcmp(output, "delabere") == 0)
|
|
yes();
|
|
else
|
|
no();
|
|
} |