注:建立新项目前一定要关闭!
# include<iostream.h>
int main()
{
char character;
int int_char;
cout<<"\n 输入要转换的字符 ==>";
cin>>character;
cout<<"\n\n字符"<<character<<"是";
int_char = int(character);//转换成整数
cout<<int_char<<"(十进制)";
cout.setf(ios::oct);
cout<<int_char<<"(八进制)";
cout.unsetf(ios::hex);
cout<<int_char<<"(十六进制)"<<endl;
cout.unsetf(ios::hex);
}
这是我自己建立的第一个有用的项目,这免得我以后为进制转换发愁了,哈哈