vault backup: 2026-01-23 21:00:23

This commit is contained in:
2026-01-23 21:00:23 +08:00
parent 19cf7e5bdc
commit 7b128d37f4
2 changed files with 38 additions and 5 deletions

View File

@@ -157,12 +157,13 @@
"state": { "state": {
"type": "outline", "type": "outline",
"state": { "state": {
"file": "YueQian/Homework/1.23.md",
"followCursor": true, "followCursor": true,
"showSearch": false, "showSearch": false,
"searchQuery": "" "searchQuery": ""
}, },
"icon": "lucide-list", "icon": "lucide-list",
"title": "大纲" "title": "1.23 的大纲"
} }
}, },
{ {
@@ -273,7 +274,7 @@
} }
} }
], ],
"currentTab": 2 "currentTab": 3
}, },
{ {
"id": "bf1e7d1a52b4651c", "id": "bf1e7d1a52b4651c",
@@ -294,8 +295,7 @@
} }
], ],
"direction": "horizontal", "direction": "horizontal",
"width": 336.5, "width": 336.5
"collapsed": true
}, },
"left-ribbon": { "left-ribbon": {
"hiddenItems": { "hiddenItems": {
@@ -316,7 +316,7 @@
"remotely-save:Remotely Save": false "remotely-save:Remotely Save": false
} }
}, },
"active": "1fec176bb492eafb", "active": "5e96455aab22a229",
"lastOpenFiles": [ "lastOpenFiles": [
"YueQian/相关网站.md", "YueQian/相关网站.md",
"YueQian/Homework/1.23.md", "YueQian/Homework/1.23.md",

View File

@@ -86,5 +86,38 @@ int main(int argc, char const *argv[])
d. 增加输入校验:若输入的 ASCII 码超出 0-127 范围,输出 “无效的 ASCII 码”;若输入的不是单个字符,输出 “输入格式错误”; d. 增加输入校验:若输入的 ASCII 码超出 0-127 范围,输出 “无效的 ASCII 码”;若输入的不是单个字符,输出 “输入格式错误”;
e. 核心要求使用scanf的返回值判断输入是否有效结合格式化控制符完成输入输出 e. 核心要求使用scanf的返回值判断输入是否有效结合格式化控制符完成输入输出
```c ```c
#include <stdio.h>
int main(int argc, char const *argv[])
{
    int ret = 0,cho = 0;
    char ch;
    int num;
    printf("输入 1字符转 ASCII、2ASCII 转字符):");
    scanf("%d",&cho);
    if(1 == cho)
    {
        ret = scanf(" %c",&ch);
        if(1 != ret)
            printf("输入格式错误 @__@ \n");
        else
            printf("%d\n",(int)ch);
    }
    else if(2 == cho)
    {
        scanf("%d",&num);
        if(0 <= num && 127 >= num )
        {
            printf("%c\n",(char)num);
        }
        else
            printf("无效的 ASCII 码 ^__^ \n");
    }
    else
        printf("无效值\n");
       
    return 0;
}
``` ```