以下为c++代码,不知是否满足需求,有问题欢迎提问,望采纳!
#include <iostream>
using namespace std;
int main()
{
char c;
do
{
cout << "请输入字符:(Ctrl + c 退出)";
cin >> c;
if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') )
{
cout << "输入字符是字母" << endl;
}
else if((c >= '0' && c <= '9'))
{
cout << "输入字符是数字" << endl;
}
else
{
cout << "其他字符" << endl;
}
}while(1);
return 0;
}