我们只要判断字符串的某一个字符是英文还是汉字即可:
- 如果为英文字母,则一定在
a到z或A到Z之间; - 否则为汉字。
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
while(cin>>s){
if((s[0]>='a'&&s[0]<='z')||(s[0]>='A'&&s[0]<='Z'))cout<<"English\n";
else cout<<"Chinese\n";
}
return 0;
}
暂无评论