📄 cpp05.cpp
字号:
// Coded by plusir -- Dec.30.2002.
// Standard C++ Bible -- (P283-11-5)
#include <iostream>
#include <ctime>
using namespace std ;
class Date
{
public:
Date( time_t ) ;
void display( void ) const ;
private:
int month ;
int day ;
int year ;
} ;
Date::Date( time_t now )
{
tm *tim = localtime( &now ) ;
day = tim->tm_mday ;
month = tim->tm_mon + 1 ;
year = tim->tm_year + 1900 ;
}
void Date::display( void ) const
{
cout << month << '/' << day << '/' << year << endl ;
}
int main()
{
time_t now = time( NULL ) ;
Date dt( now ) ;
dt.display() ;
return 0 ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -