男女做羞羞羞的事视频网站,西安房产网站大全,WordPress 302重定向,网站建设与管理 吴代文/* 编写一个程序#xff0c;读取输入#xff0c;直至读到EOF,报告读入的单词数、大写字母数、小写字母数、标点 符号数和数字字符数。使用ctype.h头文件中的函数。 */ //测试字符串 //ajskm,dl kdAj,.lfj sjkdl sdk12lfj !.,fkdj.,.lssd.1a //(ajskm),(dl) (kdAj),.(lfj) (…/* 编写一个程序读取输入直至读到EOF,报告读入的单词数、大写字母数、小写字母数、标点 符号数和数字字符数。使用ctype.h头文件中的函数。 */ //测试字符串 //ajskm,dl kdAj,.lfj sjkdl sdk12lfj !.,fkdj.,.lssd.1a //(ajskm),(dl) (kdAj),.(lfj) (sjkdl) (sdk)12(lfj) !.,(fkdj).,.(lssd).1(a) #includestdio.h #include ctype.h
#define SIZE 100
int count_word(char *string);
int main(void) { int i,count_up0,count_low0,count_pun0,count_dig0,word0; char string[SIZE]; fgets(string, SIZE, stdin); for(i0;string[i] ! \0;i) { if(isupper(string[i])) count_up; else if(islower(string[i])) count_low; else if(ispunct(string[i])) count_pun; else if(isdigit(string[i])) count_dig; else continue; } wordcount_word(string); printf(up%d\nlow%d\npun%d\ndig%d\nword%d\n,count_up,count_low,count_pun,count_dig,word); return 0; }
int count_word(char *string) { int i,count0; int in_word0; for(i0;iSIZE;i) { if(isalpha(string[i])) in_word1; else if(in_wordisalpha(string[i])0) { count; in_word0; } else if(in_wordstring[i]\0) { count; in_word0; } else in_word0; } return count; }