摘要: 单词用空白键隔开。算法:每当遇到一个非空白字符,且该非空白字符的前面是空白字符,则单词数加1.该非空白符的前面是不是空白符用isword表示。注意不能用空白符的个数来表示单词的个数!#include <stdio.h>#include <string.h>int nword(char *s){ int nword = 0; int isword = 1; while (*s) { if (iss... 阅读全文
posted @ 2012-12-10 11:36 helloweworld 阅读(573) 评论(0) 推荐(0) 编辑
摘要: /*字符串中大写字母变成小写,其余字符不变*/#include <stdio.h>#include <string.h>char* mystrlwr(char *s){ char *scopy = s; while (*s) { if (*s >= 'A' && *s <= 'Z') { *s = *s + 'a' - 'A'; } s++; } return scopy;}char *... 阅读全文
posted @ 2012-12-10 10:46 helloweworld 阅读(2123) 评论(0) 推荐(0) 编辑