#include <iostream> #include <stdio.h> using namespace std; int main() { char s; int numWords = 0; s=getchar(); while(s!='\n'){ if(!isspace(s)){ numWords++; while(!isspace(s)&&s!='\n') s=getchar(); } else { s=getchar(); } } cout<<numWords<<std::endl; }
摘抄--读取单词个数
最新推荐文章于 2023-09-25 05:23:24 发布