You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
475 B
C
31 lines
475 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
FILE *input = fopen("bit_3.dat","r");
|
|
int nya;
|
|
char t;
|
|
fscanf(input, "%x\n", &nya);
|
|
fclose(input);
|
|
|
|
t = (nya >> 4) & 1;
|
|
t += ((nya >> 5) & 1) * 2;
|
|
|
|
FILE *output = fopen("bit_3.ans","w");
|
|
switch (t) {
|
|
case 3:
|
|
fprintf(output, "%s", "bk");
|
|
break;
|
|
case 2:
|
|
fprintf(output, "%s", "bw");
|
|
break;
|
|
case 1:
|
|
fprintf(output, "%s", "rd");
|
|
break;
|
|
case 0:
|
|
fprintf(output, "%s", "bn");
|
|
break;
|
|
}
|
|
|
|
fclose(output);
|
|
}
|