c语言合法标识符
2024-09-26 22:01:29
#include <iostream>
#include <stdio.h>
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"<<endl;
else cout<<"no"<<endl;
}
return 0;
}
最新文章
- python subprocess阻塞
- Thinkphp源码分析系列–开篇
- JAX-RS入门
- stm32 堆和栈(stm32 Heap &; Stack)【worldsing笔记】
- Socket实现简单的聊天通信
- Egret 事件机制
- C学习-fgets()篇1
- [原创]linux简单之美(一)
- AVL树----java
- NPOI封装
- .net core 2.0学习笔记(五):程序配置&;ConfigurationManager
- C# RichTextBox设置行间距
- Java中clone方法的使用
- -bash:syntax error near unexpected token &#39;(&#39;
- Node.js建立服务、路径处理与响应
- NodeJS 模块&;函数
- Clone of COCO API
- jpetStore 学习总结(1)
- 多线程简单案例 - join( ) -lock()
- Memory leak by misusing Autofac