我們先來看一個原始碼
#include <stdio.h>
#include <string.h>
main () {
char A[12];
char B[256];
fgets(B, sizeof(B)+sizeof(A), stdin);
if (!strcmp(A, "LOVE\n"))
printf("YOU WIN.\n\n");
else
printf("Sorry. try it next time\n\n");
}
#include <stdio.h>
#include <string.h>
main () {
char A[12];
char B[256];
fgets(B, sizeof(B)+sizeof(A), stdin);
if (!strcmp(A, "LOVE\n"))
printf("YOU WIN.\n\n");
else
printf("Sorry. try it next time\n\n");
}