#include <iostream.h>
#include <string.h>
void main()
{
char key[32][9]={"main","coutinue","define","if","short","switch","volatile",
"break","default","include","int","signed","typedef","while","case","do",
"float","long","sizeof","union","char","double","for","register",
"static","unsigned","const","else","goto","return","struct","void"};
char a[20];
cout<<"please input:";
cin>>a;
cout<<"输入字符"<<" "<<"类型"<<" "<<"次序"<<" "<<endl;
for(int i=0;i<32;i++)
{
if(strcmp(key[i],a)==0)
{
cout<<a<<" "<<"关键字"<<" "<<i+1<<" "<<endl;
break;
}
}
static int count=0;
int k=0;
char b[20]={0};
for(int j=0;j<strlen(a);j++)
{
if(a[j]>='0'&&a[j]<='9')
{
b[k]=a[j];
k++;
}
else
{
if(strlen(b))
{count++;
cout<<count<<" "<<b<<" "<<"数字"<<endl;
k=0;
}
}
if(j==(strlen(a)-1)&&a[j]>='0'&&a[j]<='9')
{
count++;
cout<<count<<" "<<b<<" "<<"数字"<<endl;
}
if(a[j]=='+'||a[j]=='-'||a[j]=='*'||a[j]=='/')
{
count++;
cout<<count<<" "<<a[j]<<" "<<"运算符"<<endl;
}
if(a[j]==','||a[j]=='.'||a[j]==';'||a[j]==':')
{
count++;
cout<<count<<" "<<a[j]<<" "<<"特殊字符"<<endl;
}
if(a[j]=='?'||a[j]=='$')
{
count++;
cout<<count<<" "<<a[j]<<" "<<"特殊字符"<<endl;
}
if(a[j]=='{'||a[j]=='}'||a[j]=='~'||a[j]=='!')
{
count++;
cout<<count<<" "<<a[j]<<" "<<"特殊字符"<<endl;
}
if(a[j]=='['||a[j]==']'||a[j]=='@'||a[j]=='#')
{
count++;
cout<<count<<" "<<a[j]<<" "<<"特殊字符"<<endl;
}
if(a[j]=='%'||a[j]=='^'||a[j]=='&'||a[j]=='('||a[j]==')')
{
count++;
cout<<count<<" "<<a[j]<<" "<<"特殊字符"<<endl;
}
if((a[j]>='a'&&a[j]<='z')||(a[j]>='A'&&a[j]<='Z'))
{
count++;
cout<<count<<" "<<a[j]<<" "<<"字母"<<endl;
}
}
}
cifa.rar_visual c
版权申诉
195 浏览量
2022-09-23
08:34:21
上传
评论
收藏 746B RAR 举报
![avatar](https://profile-avatar.csdnimg.cn/3b38fb294f114a0a8dfd7bc633aed231_weixin_42660494.jpg!1)
alvarocfc
- 粉丝: 112
- 资源: 1万+
最新资源
- TbReactions(BaseModel)
- request-validator.cpython-37
- pygments.lexers.javascript ~~~~~~~~~~~~~~~~~~~~~~~~~~
- 简单小游戏制作-飞行棋
- Python数学建模例子.rar
- Java项目-基于SSM+JSP的校园外卖配送系统的设计与实现(源码+万字LW+部署视频+代码讲解视频+全套软件)
- Color-Transformer introduction
- FastStone Capture屏幕长截图软件包
- Table IoT物联网工具,简单快速的搭建物联网服务平台
- zheng2020 ecg new dataset-12 lead-add-label
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)