chenlong991223
#include<stdio.h>
#include<ctype.h>//调用isalpha函数 
int main()
{
    int n;
    char a[55];
    while(scanf("%d%*c",&n)!=EOF)
    {
        while(n--)
        {
            int d=1;
            gets(a);
            if(a[0]!=\'_\'&& !isalpha(a[0]))   //isalpha函数用来判断字符是否为英文字母 
            {
                printf("no\n");
            }
            else
            {
                for(int j=1;a[j]!=\'\0\';j++)
                {
                    if(a[j]!=\'_\'&&!isalnum(a[j]))
                    {
                        
                        d=0;
                        break;
                    }
                }
                puts(d ? "yes" : "no");      
            }        
        }
    }
    return 0;
}
HINT
C语言的标识符指保留字(for,int,if等)和用户定义的变量名。

C语言的标识符由字母、数字和下划线组成,其中第一个字符必须是字母或者下划线

 

分类:

技术点:

相关文章: