⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stdafx.cpp

📁 一个很漂亮的数字时钟程序,你一定会喜欢的.
💻 CPP
字号:
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -