您的位置:首页 > 其它

杭电 hdu 2024

2013-07-25 18:58 190 查看
C语言合法标识符:
#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
#define N 1000
char str
;
int main(){
int n;
cin>>n;
cin.ignore();
while(n--){
gets(str);
int len=strlen(str);
int t=0;
if((str[0]<='z'&&str[0]>='a')||(str[0]<='Z'&&str[0]>='A')||
str[0]=='_'){
int i;
for(i=1;i<len;++i){
if((str[i]<='z'&&str[i]>='a')||(str[i]<='Z'&&str[i]>='A')||
(str[i]<='9'&&str[i]>='0')||str[i]=='_')
continue;
else{
cout<<"no"<<endl;
t=1;
break;
}
}
}
else{
t=1;
cout<<"no"<<endl;
}
if(t==0)
cout<<"yes"<<endl;
}
return 0;
}


本文出自 “菜鸟的进阶之路” 博客,请务必保留此出处http://beyond316.blog.51cto.com/7367775/1257411
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: