UVA 494 Kindergarten Counting Game
题意:输出多组一句话,统计有多少个单词。
Sample Input: 
//UVA 494
//Kindergarten Counting Game
//by Yanx
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    char a[10010];
    while(gets(a)!='\0')
    {
        int count=0;
        for(int i=0;a[i];i++)
        {
            if(((a[i]>='A'&&a[i]<='Z')||(a[i]>='a'&&a[i]<='z'))&&((a[i+1]<'A'||a[i+1]>'Z')&&(a[i+1]<'a'||a[i+1]>'z')))
            count++;
        }
        printf("%d\n",count);
    }
}
                
                  
                  
                  
                  
                            
本文提供了一种解决UVA494 Kindergarten Counting Game问题的方法,通过C++实现来统计输入句子中单词的数量。该程序利用字符判断和循环遍历来完成单词的计数。
          
      
          
                
                
                
                
              
                
                
                
                
                
              
                
                
              
            
                  
					140
					
被折叠的  条评论
		 为什么被折叠?
		 
		 
		
    
  
    
  
            


            