// 6_6-4.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <string>
#include <windows.h>

using namespace std;

bool range(string cmnd, int n);

int _tmain(int argc, _TCHAR* argv[])
{
	range("mini",1);
	range("max",12);
	if (range("chk", 5)) {
		cout << "範囲内です。\n";
	}
	else {
		cout << "範囲外です。\n";		
	}

	MessageBox(NULL, _T("Check Console Window"), L"MessageBox", MB_OK);

	return 0;
}

bool range(string cmnd, int n)
{
	static int mini = 0, max = 0;
	if (cmnd == "mini") {
		mini = n;
	}
	else if (cmnd == "max") {
		max = n;
	}
	else if (cmnd == "chk") {
		return mini <= n && n <= max;
	}
	else {
		cout << "ERR!\n";
		exit(1);
	}
	return true;
}
