#include
using namespace std;
int main()
{
char ch;
while(cout<<"Enter one Character(ctrl+z to end):"<
{
if(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z')
cout<<"ASCII:"<
return 0;
}
//标准的C++程序
//static_cast
//以下针对修改程序
#include
using namespace std;
int main()
{
char ch;
cout<<"Enter one Character:"<
if(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z')
cout<<"ASCII:"<
}
#include
using namespace std;
int main()
{
char ch;
cout << "请输入一个字符:" << endl;
cin >> ch;
if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch >= '0' && ch <= '9')
{
cout << "输入的字符" << ch << "所对应的ASCII码值为:" << int(ch) << endl;
}
else
{
cout << "输入有误!" << endl;
}
return 0;
}
#include
#include
using namespace std;
int main() {
char c;
while (cin >> c) {
if (isalpha(c)) {
cout << (int) c << endl;
}
}
}
char d;
int a;
if(d>='a'&&d<='z')
a=(int)d;
输出a;