mirror of
https://github.com/Aexiar/c.git
synced 2024-10-22 12:05:45 +00:00
c
This commit is contained in:
parent
5ddeb3b277
commit
69d7472e28
@ -1019,7 +1019,9 @@ int main() {
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
// 禁用 stdout 缓冲区
|
||||||
|
setbuf(stdout, NULL);
|
||||||
|
|
||||||
// 使用整型来表示真和假两种状态
|
// 使用整型来表示真和假两种状态
|
||||||
int handsome = 0;
|
int handsome = 0;
|
||||||
printf("帅不帅[0 丑,1 帅]: ");
|
printf("帅不帅[0 丑,1 帅]: ");
|
||||||
@ -1052,7 +1054,9 @@ int main() {
|
|||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
// 禁用 stdout 缓冲区
|
||||||
|
setbuf(stdout, NULL);
|
||||||
|
|
||||||
BOOL handsome = 0;
|
BOOL handsome = 0;
|
||||||
printf("帅不帅[FALSE 丑,TRUE 帅]: ");
|
printf("帅不帅[FALSE 丑,TRUE 帅]: ");
|
||||||
scanf("%d", &handsome);
|
scanf("%d", &handsome);
|
||||||
@ -1078,12 +1082,17 @@ int main() {
|
|||||||
```c
|
```c
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
// 禁用 stdout 缓冲区
|
||||||
|
setbuf(stdout, NULL);
|
||||||
|
|
||||||
|
int temp; // 使用 int 类型的变量临时存储输入
|
||||||
_Bool handsome = 0;
|
_Bool handsome = 0;
|
||||||
printf("帅不帅[0 丑,1 帅]: ");
|
printf("帅不帅[0 丑,1 帅]: ");
|
||||||
scanf("%d", &handsome);
|
scanf("%d", &temp);
|
||||||
|
|
||||||
|
// 将输入值转换为 _Bool 类型
|
||||||
|
handsome = (temp != 0);
|
||||||
|
|
||||||
if (handsome) {
|
if (handsome) {
|
||||||
printf("你真的很帅!!!");
|
printf("你真的很帅!!!");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user