c++ 中 bool 与整型之间的转换 |
您所在的位置:网站首页 › series如何转换为int › c++ 中 bool 与整型之间的转换 |
c++ 中 bool 与整型之间的转换 在c++中bool类型与整型之间存在着隐式转换,bool在存储之后隐式的转换为整型存储,其中true为1,false则为0。如果用整型给bool对象赋值,非零值为true,0则为false。 #include using namespace std; int main() { bool t = true; cout |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |