diff --git a/docs/notes/01_c-basic/03_xdx/index.md b/docs/notes/01_c-basic/03_xdx/index.md index 77f8e10..e237074 100644 --- a/docs/notes/01_c-basic/03_xdx/index.md +++ b/docs/notes/01_c-basic/03_xdx/index.md @@ -1019,7 +1019,9 @@ int main() { #include int main() { - + // 禁用 stdout 缓冲区 + setbuf(stdout, NULL); + // 使用整型来表示真和假两种状态 int handsome = 0; printf("帅不帅[0 丑,1 帅]: "); @@ -1052,7 +1054,9 @@ int main() { #define FALSE 0 int main() { - + // 禁用 stdout 缓冲区 + setbuf(stdout, NULL); + BOOL handsome = 0; printf("帅不帅[FALSE 丑,TRUE 帅]: "); scanf("%d", &handsome); @@ -1078,12 +1082,17 @@ int main() { ```c #include - int main() { + // 禁用 stdout 缓冲区 + setbuf(stdout, NULL); + int temp; // 使用 int 类型的变量临时存储输入 _Bool handsome = 0; printf("帅不帅[0 丑,1 帅]: "); - scanf("%d", &handsome); + scanf("%d", &temp); + + // 将输入值转换为 _Bool 类型 + handsome = (temp != 0); if (handsome) { printf("你真的很帅!!!");