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

📄 clock.cpp

📁 数据结构电梯程序设计 数据结构电梯程序设计
💻 CPP
字号:
//Clock.cpp
#include"All.h"

Clock::Clock()
{ 
	currenttime = time(0) ; 
}

long int Clock::gettime() 
{
	return currenttime ;
}

void Clock::showtime() 
{
	int t = time(0) ;
	int todaysecond = t % ( 24 * 60 * 60 ) ;

	hour = todaysecond / ( 60 * 60 ) + 8 ;
	minute = todaysecond / 60 % 60 ;
	second = todaysecond % 60 ;

	if( hour < 10 )
		cout << "0" ;
	cout << hour << " 点 " ;
	if( minute < 10 )
		cout << "0" ;
	cout << minute << " 分 " ;
	if( second < 10 )
		cout << "0" ;
	cout << second << "秒" ;
}

void Clock::change( long int x ) 
{
	int todaysecond = x % ( 24 * 60 * 60 ) ;

	int h = todaysecond / ( 60 * 60 ) + 8 ;
	int m = todaysecond / 60 % 60 ;
	int s = todaysecond % 60 ;

	if( h < 10 )
		cout << "0" ;
	cout << h << " 点 " ;
	if( m < 10 )
		cout << "0" ;
	cout << m << " 分 " ;
	if( s < 10 )
		cout << "0" ;
	cout << s << "秒" ;

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -