// 21_21-11.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <windows.h>

using namespace std;

void dispflg(ios_base::fmtflags fm)
{
	int i;
	for (i = 0x8000; i > 0; i = i>>1) {
		if (i == 0x800 || i == 0x80 || i == 0x8) {
			cout << " ";
		}
		if (fm & i) {
			cout << "1";
		}
		else {
			cout << "0";
		}
	}
	cout << '\n';
}

int _tmain(int argc, _TCHAR* argv[])
{
	ios_base::fmtflags myfm1, myfm2, myfm3;

	cout << "-----起動直後の書式フラグ\n";
	myfm1 = cout.flags();
	dispflg(myfm1);

	myfm2 = cout.flags(cout.flags() | ios_base::showpos);
	myfm3 = cout.flags();
	cout << "-----書式フラグ変更前の値\n";
	dispflg(myfm2);
	cout << "-----書式フラグ変更後の値\n";
	dispflg(myfm3);
	
	MessageBox(NULL, _T("Check Console Window"), L"MessageBox", MB_OK);

	return 0;
}

