词汇统计
2016-03-16 12:09
225 查看
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <iostream.h>
int main(int argc, char* argv[])
{
char x[1000];
unsigned int i=0 ;
int n=0 ;
char flag=0;
cin.getline(x,255);
strcat(x," ");
for(i=0;i<strlen(x);i++)
{
if(((x[i]>='a')&&(x[i]<='z'))||((x[i]>='A')&&(x[i]<='Z')))
{ flag=1;}
else
{
if (flag==1 ) n++;
flag=0;
}
}
printf("%d\n",n);
getchar();
return 0;
}
#include <string.h>
#include <stdio.h>
#include <iostream.h>
int main(int argc, char* argv[])
{
char x[1000];
unsigned int i=0 ;
int n=0 ;
char flag=0;
cin.getline(x,255);
strcat(x," ");
for(i=0;i<strlen(x);i++)
{
if(((x[i]>='a')&&(x[i]<='z'))||((x[i]>='A')&&(x[i]<='Z')))
{ flag=1;}
else
{
if (flag==1 ) n++;
flag=0;
}
}
printf("%d\n",n);
getchar();
return 0;
}
相关文章推荐
- Spring加载XML配置文件
- lintcode-medium-Container with Most Water
- 【游戏客户端开发】Unity3D 学习笔记3——Unity3D资源目录及资源读取
- Android图片海报制作-MVP的使用
- 自定义Cordova-Android插件
- The best resources for learning exploit development
- EF—主键冲突解决办法
- hdfs格式化hadoop namenode -format错误
- AWS安装rz,sz
- 【游戏客户端开发】Unity3D 学习笔记2——了解U3D引擎的操作面板和各种工具
- Word2010中插入多级列表编号的三种方法
- RunLoop 原理和核心机制
- xcode6中添加pch全局引用文件
- Eclipse中svn设置提交时忽略某些文件夹和文件
- HTTP header头信息
- android Gallery2 onPause时候,其背景界面显示黑色
- linux myql主从复制和双主备份
- Selenium基础知识(元素定位的调试)
- Reverse Bit
- mac protobuf自动编译