cout << boolalpha << y<<endl;
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(void)
{
?int x = 0;
?cout <<"請輸入一個整數:"<<endl;
?cin >>x;
?cout <<oct << x <<endl;
?cout << dec <<x <<endl;
?cout << hex <<x <<endl;
?
?cout <<"請輸入一個布爾值(0,1):"<< endl;
?bool y = false;
?cin >> y;
?cout <<? y<<endl;?????
system("pause");
?return 0;
}?
問題:我沒有輸入boolalpha結果也是一樣的??
2018-04-23
結果一樣,但是意義不一樣,沒有輸入boolalpha出來的值就不是布爾值