随机输入一段话,怎样判断输入的是中文还是字母,各有多少个?
解决方案 »
- VC有关Datalist和ADO联合使用输出数据库中表的内容
- WTL TabBrowser表单自动完成导致浏览器崩溃
- 【请教】删除指定路径下文件夹中所有的文件?
- PacketOpenAdapter 与 PacketCloseAdapter 问题??求助
- directshow:我给Filter添加接口的时候出现了link2001错误:无法处理接口的IID_XXXX符号。这是为什么呢?
- 怎样将这个结构的ip和port内容加入列表中?
- 请问怎么得到WAV文件的时间长度
- 单文档界面,启动时不显示任何视图,怎么做?
- 怎样用VC60实现Ado数据库连接.和SQL语句的执行
- 我的问题,比较棘手
- 请问这SQL有什么错啊?
- 关于向工具栏添加ComboBox一问,UP者勿进!
MsgBox "汉字"
ElseIf IsNumeric(c) Then
MsgBox "数字"
ElseIf (c >= "A" And c <= "Z") Or (c >= "a" And c <= "z") Then
MsgBox "英文"
End If
void DealChar( char *pChar, int *nEnglishCount, int *nChineseCount )
{
int nECount = 0, nCCount = 0;
for( int i = 0; i < strlen( pChar ); i ++ )
{
if( pChar[i] > 128 )
nCCount ++;
else
nECount ++;
}
*nEnglishCount = nECount;
*nChineseCount = nCCount;
}//Use
int nC = 0, nE = 0;
char buf[1024] = "Hello 中国人!";
DealChar( buf, &nE, &nC );
// nE = 7, nC = 6
#include "stdafx.h"
#include <tchar.h>
#include "string"
using namespace std;
#include "windows.h"int main(int argc, char* argv[])
{
char *str="abc中文汉字def";
char *p=str,*p1;
unsigned short ch;
//str2按字遍历字符串
string str2="";
while(strcmp(p,"")!=0)
{
str2="";
p1=CharNextExA(936,p,0);
int i=p1-p;
if(i==1)
{
ch=(unsigned char)*p;
str2+=*p;
}else if(i==2)
{
ch=(*p)*256+*(p+1);
str2+=*p;
str2+=*(p+1);
}
p=p1;
// p是剩下的字符串,ch是一个字的值
}
return 0;
}
char str[]="汉";
应该str[1]<0吧