![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言疑问与解答
少年与心理学
这个作者很懒,什么都没留下…
展开
-
C语言疑问与解答
问题 程序要求 编写一个程序,提示用户输入名字,在比姓名宽度宽3的字段中打印名字。 解决方案 方案 -1 直接在变量后面添加空格(space) 示例 #include <stdio.h> int main(void) { int name ...原创 2019-07-17 08:30:59 · 272 阅读 · 0 评论 -
C语言 - if替换contiune
//continue #include <stdio.h> #include <ctype.h> #include <Windows.h> int main(void) { char ch; while ((ch = getchar()) != '#') { if (ch == '\n') continue; printf("Step ...原创 2019-08-05 08:38:56 · 383 阅读 · 0 评论 -
C语言 - 代码改进
1.while语句 当结尾有scanf是可直接用scanf来做判断条件 scanf("%c",&ch); while (ch != '#') { ... scanf("%c",&ch); } //替换为 while ((ch = getchar()) != '#') { ... } 2.连续读取两个字符并判断 scanf("%c",&ch); while (ch...原创 2019-08-07 10:57:31 · 207 阅读 · 0 评论