#include
using namespace std;
int main()
{
int i=0,num=0;
char str[1000];
cin>>str;
while(str[i]!=0)
{
if((str[i]&0x80)==0x80) num++;
i++;
}
num/=2;
cout
再问: 标点符号还是不能喝汉字区分开来啊~~~
再答: while(str[i]!=0) { if((num%2==0) &&(str[i]
C++中输入一段字符(无限制,文章中常见的均可),要求判断其中的汉字的数目.
不包括GB2312编码中除了汉字意外的标点符号等.
#include
using namespace std;
int main()
{
int i=0,num=0;
char str[1000];
cin>>str;
while(str[i]!=0)
{
if((str[i]&0x80)==0x80) num++;
i++;
}
num/=2;
cout
再问: 标点符号还是不能喝汉字区分开来啊~~~
再答: while(str[i]!=0) { if((num%2==0) &&(str[i]