第1个回答 2006-12-11
cout<<"%d"<<a肯定不行了,这样cout<<(int)a<<endl;在输出时做一下强制类型转换,(int)a不会对a的类型影响,只是产生一个临时变量
要想输出是16进制的加个hex就行了,比如
cout<<hex<<(int)a<<endl;本回答被提问者采纳
第2个回答 2006-12-11
printf("%d",a);//输出A的ASCII码,以十进制表示
第3个回答 2006-12-11
#include <iostream>
using namespace std;
void main()
{
int a='a';
cout<<a<<endl;
}