文章目录 1.通过ascii码:2.直接转换(更简单,推荐) 1.通过ascii码:
char a 0;
int ia (int)a;
/* note that the int cast is not necessary -- int ia a would suffice */
cout<<ia<<endl;结果如下&a…
1.通过ascii码:
char a 0;
int ia (int)a;
/* note that the int cast is not necessary -- int ia a would suffice */
cout<<ia<<endl;
结果如下: 可以看出这种方法得到的其实是char对应的ascii码。 因为ascii码的数字(…