C++:char轉換爲int(char to int )

文章目錄 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; 結果以下: web 能夠看出這種方法獲得的實際上是char對應的as
相關文章
相關標籤/搜索