随笔分类 - C Programming
摘要:1.打印输入中单词长度2.打印输入中各个字符出现频度的直方图#include #include #include #define IN 1#define OUT 0main(){ int nc, nw, count, state, input; int nclist[26]; ...
阅读全文
摘要:1. 统计行数、单词数与字符数2. 单词认为是任何其中不包含空格、制表符或换行符的字符序列#include #include #define IN 1#define OUT 0main(){ int nl,nw,nc,input,state; nl = nw = nc = 0; s...
阅读全文
摘要:1. 连续空格用一个空格替换2. 制表符用\t替换,换行符用\n替换,反斜杠用\\替换#include #include main(){ int input; while((input=getchar())!=EOF){ if(input == '\n'){ ...
阅读全文
摘要:包括统计字符,空格,制表符,换行符:#include #include main(){ /* count characters, spaces & lines in input */ double lines,chars,spaces,tabs; int input; ...
阅读全文
摘要:借助于getchar 与putchar 函数,可以在不了解其它输入/输出知识的情况下编写出数量惊人的有用的代码。最简单的例子就是把输入一次一个字符地复制到输出,其基本思想如下:读一个字符while (该字符不是文件结束指示符)输出刚读入的字符读下一个字符将上述基本思想转换为C语言程序为:#inclu...
阅读全文
摘要:开始看C语言,主要是复习,所以就没必要从hello world开始了,写点例子熟悉下就好了。使用公式℃=(5/9)(℉-32)打印下列华氏温度与摄氏温度对照表:#include #include main(){ // c = (5/9)(f-32) int low,high,...
阅读全文

浙公网安备 33010602011771号