#include "DxLib.h"
#include <stdio.h>
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance , HINSTANCE hPrevInstance , PSTR lpCmdLine , int nCmdShow ) {
SetGraphMode( 250, 100, 16);
ChangeWindowMode(TRUE); //ウィンドウモードに変更する為の関数
SetWindowStyleMode(6);
DxLib_Init(); //DXライブラリの初期化
SetAlwaysRunFlag(TRUE);
SetDrawScreen(DX_SCREEN_BACK); //描画先を裏画面に変更(13章参照)
int White = GetColor( 255,255,255 );
while( CheckHitKey(KEY_INPUT_SPACE)==0 ){
GetDateTime( &Date );
ProcessMessage();
ClearDrawScreen();
int year = KeyInputNumber( 0 , 16 , 9999 , 1000 , FALSE ) ;
if( year %100 == 0 )
{
if( year %400 == 0 )
DrawFormatString( 0,0, White,"%d年は閏年です。" ,year );
else
DrawFormatString( 0,0, White, "%d年は閏年ではありません。", year );
}
else
{
if( year %4 == 0)
DrawFormatString( 0,0, White, "%d年は閏年です。",year);
else
DrawFormatString( 0,0, White, "%d年は閏年ではありません。",year);
}
ScreenFlip();
}
DxLib_End();
return 0;
}
見にくかったらすみません。
まずKeyInputNumber( 0 , 16 , 9999 , 1000 , FALSE ) ;で西暦年を入力し、計算に従い閏年か否かを判別するプログラムなんですが。
判別はうまく出来るんですが、一回動かしてもらえるとわかるとおり、閏年かどうかのコメントが表示された瞬間、消えてしまいます。
さらに、Escキーを押しても終了させることができません。
何故でしょうか?わかる方お願いします。
VisualC++ 2010
DxLibを使っています。
タイトル着け忘れました。
