vault backup: 2026-01-23 19:52:38
This commit is contained in:
18
.obsidian/workspace.json
vendored
18
.obsidian/workspace.json
vendored
@@ -23,6 +23,20 @@
|
||||
"title": "相关网站"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "417cedc6fc7b40cb",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "webviewer",
|
||||
"state": {
|
||||
"url": "http://music.zbright.top/",
|
||||
"title": "道理鱼音乐管理",
|
||||
"mode": "webview"
|
||||
},
|
||||
"icon": "globe-2",
|
||||
"title": "道理鱼音乐管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "6bbdb6c9df9a2d8f",
|
||||
"type": "leaf",
|
||||
@@ -67,7 +81,7 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"currentTab": 3
|
||||
"currentTab": 4
|
||||
},
|
||||
{
|
||||
"id": "84db982cf765aaad",
|
||||
@@ -318,10 +332,10 @@
|
||||
},
|
||||
"active": "1fec176bb492eafb",
|
||||
"lastOpenFiles": [
|
||||
"YueQian/相关网站.md",
|
||||
"YueQian/Homework/1.23.md",
|
||||
"Collection/YoudaoyunNotes/01Linux基础/02_Linux概述.md",
|
||||
"BlogWebsite/Article/MarkdownTest.md",
|
||||
"YueQian/相关网站.md",
|
||||
"Collection/连~都忘记了的小知识.md",
|
||||
"Diary/2026-1/2026-1-23 周五.md",
|
||||
"Diary/2026-1/2026-1-22 周四.md",
|
||||
|
||||
@@ -65,7 +65,19 @@ int main(int argc, char const *argv[])
|
||||
```
|
||||
4.定义字符串`char *name = "Programmer"`,分别输出完整字符串、前 5 个字符、左对齐占 10 位、右对齐占 10 位的格式;
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
char *name = "Programmer";
|
||||
|
||||
printf("%s\n",name);
|
||||
printf("%.5s\n",name);
|
||||
printf("%-10.5s\n",name);
|
||||
printf("%10.5s\n",name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
5.编写一个综合程序,结合格式化输入输出、类型转换、IO 流知识点,实现 “字符↔ASCII 码” 双向转换:
|
||||
1. 提示用户选择功能:输入 1(字符转 ASCII)、2(ASCII 转字符);
|
||||
@@ -73,3 +85,6 @@ int main(int argc, char const *argv[])
|
||||
3. 若选择 2:接收用户输入的 ASCII 码值(0-127),输出对应的字符(int→char,显式转换);
|
||||
4. 增加输入校验:若输入的 ASCII 码超出 0-127 范围,输出 “无效的 ASCII 码”;若输入的不是单个字符,输出 “输入格式错误”;
|
||||
5. 核心要求:使用scanf的返回值判断输入是否有效,结合格式化控制符完成输入输出
|
||||
```c
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user