c++程序—布尔值
#include<iostream> using namespace std; #include<string> int main() { //创建bool数据类型 bool flag = true; cout << flag << endl; flag = false; cout << flag << endl; //bool所占内存空间 cout << sizeof(bool) << endl; system("pause"); return 0; }
#include<iostream> using namespace std; #include<string> int main() { //创建bool数据类型 bool flag = true; cout << flag << endl; flag = false; cout << flag << endl; //bool所占内存空间 cout << sizeof(bool) << endl; system("pause"); return 0; }