摘要: c语言中数字字符计数。 1、 #include <stdio.h> int main(void) { int i, ch; int cnt[10] = {}; while((ch = getchar()) != EOF) { switch(ch) { case '0': cnt[0]++; brea 阅读全文
posted @ 2021-05-23 23:09 小鲨鱼2018 阅读(431) 评论(0) 推荐(0) 编辑
摘要: c语言中将输入的字符直接输出 getchar函数 和EOF getchar函数用于读取字符并返回,(getchar和putchar都只处理一个字符); EOF是对象式宏,为一个负值。 1、 #include <stdio.h> int main(void) { int ch; while((ch = 阅读全文
posted @ 2021-05-23 22:33 小鲨鱼2018 阅读(1156) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int ch; int time[1] = {}; while((ch = getchar()) != EOF) { switch(ch) { case '\n': time[0]++; break; } } printf 阅读全文
posted @ 2021-05-23 11:31 小鲨鱼2018 阅读(48) 评论(0) 推荐(0) 编辑