<pre name="code" class="cpp">int main()
{
int a = 48;
char c = a; //将数字赋给字符得到的是ASC为该数的字符0
char d = (char)a; //同样的结果0
char e = static_cast<char>(a); //同样的结果0
cout << c << endl;
cout << d << endl;
cout << e << endl;
return 0;
}
char&int的转换
最新推荐文章于 2023-07-18 13:28:38 发布