stdafx.cpp
来自「一个很漂亮的数字时钟程序,你一定会喜欢的.」· C++ 代码 · 共 66 行
CPP
66 行
// stdafx.cpp : source file that includes just the standard includes
// Alarm.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
/*
Allowed values are 0 to 23.
*/
BOOL Time24toAP(const int i24Hour, BOOL &bAM, int &iAPHour)
{
if (i24Hour >= 0 && i24Hour < 24) ;
else
return FALSE;
if (i24Hour >= 0 && i24Hour < 12)
{
bAM = TRUE;
if (i24Hour == 0)
iAPHour = 12;
else
iAPHour = i24Hour;
}
else if (i24Hour >= 12 && i24Hour < 24)
{
bAM = FALSE;
if (i24Hour == 12)
iAPHour = i24Hour;
else
{
iAPHour = i24Hour - 12;
}
}
return TRUE;
}
/*
Allowed values are 1 to 12.
*/
BOOL TimeAPto24(const int iAPHour, const BOOL bAM, int &i24Hour)
{
if (iAPHour >= 1 && iAPHour <= 12) ;
else
return FALSE;
if (bAM) // AM
{
if (iAPHour == 12)
i24Hour = 0;
else
i24Hour = iAPHour;
}
else
{ // PM
if (iAPHour == 12)
i24Hour = 12;
else
{
i24Hour = iAPHour + 12;
}
}
return TRUE;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?