学习了接受换行的方法,scanf()遇到换行和空格就停止了,另外学习了一点儿编程技巧,写宏命令能让程序更短
#include "stdio.h"#include "string.h"#define FUN(a) ((a >= 97 && a <= 122) || (a >= 65 && a <= 90 ))main(){ char a ,b = ' ',sum = 0; while((a = getchar()) != EOF) { if('\n' == a) { printf("%d\n",sum); b = ' '; sum = 0; } else { if( FUN(a) && (!FUN(b)) ) sum++; b = a; } } return 0;}