c语言合法标识符

【c语言合法标识符】#include
#include
using namespace std;
char str[100][51];
int main()
{
int i,j,n,f,t;
cin>>n; getchar();
for(i=1; i<=n; i++)
{
gets(str[i]);
for(j=0; str[i][j]!='\0'; j++)
t=j;
f=0;
if((str[i][0]>='A'&&str[i][0]<='Z')||(str[i][0]>='a'&&str[i][0]<='z')||str[i][0]=='_')
{
f=1;
for(j=1; j<=t; j++)
{
if((str[i][j]>='0'&&str[i][j]<='9')||(str[i][j]>='A'&&str[i][j]<='Z')||(str[i][j]>='a'&&str[i][j]<='z')||str[i][j]=='_') {f=1; }
else {f=0; break; }
}
}
else f=0;
if(f==1) cout<<"yes"< else cout<<"no"< }
return 0;
}
转载于:https://www.cnblogs.com/NYNU-ACM/p/4658265.html

    推荐阅读