²é¿´: 1960  |  »Ø¸´: 7
±¾Ìû²úÉú 1 ¸ö ³ÌÐòÇ¿Ìû £¬µã»÷ÕâÀï½øÐв鿴
µ±Ç°Ö»ÏÔʾÂú×ãÖ¸¶¨Ìõ¼þµÄ»ØÌû£¬µã»÷ÕâÀï²é¿´±¾»°ÌâµÄËùÓлØÌû

wuyan070987

½ð³æ (СÓÐÃûÆø)

°³²»ÊÇÎÄ»¯Òø

[ÇóÖú] c++±àдһ¸ö¹ØÓÚʱ¼äµÄ³ÌÐò£¬Ð»Ð»

ÊÔ±àдһ¸öÓйØÈÕÆÚ(Äê¡¢Ô¡¢ÈÕ)ºÍʱ¼ä(ʱ¡¢·Ö¡¢Ãë)µÄ³ÌÐò¡£¸Ã³ÌÐò½¨Á¢Èý¸öÀ࣬ÆäÖÐÒ»¸öÊÇÈÕÆÚµÄÀàDate£¬Ò»¸öÊÇʱ¼äµÄÀàTime£¬ÁíÒ»¸öÊÇÈÕÆÚºÍʱ¼äÀàDateTime£¬ËüÊÇÇ°ÃæÁ½¸öÀàΪ»ùÀàµÄÅÉÉúÀà¡£
»Ø¸´´ËÂ¥

» ÊÕ¼±¾ÌûµÄÌÔÌûר¼­ÍƼö

¿ÆÑÐÏà¹Ø×ÊÁÏ

» ²ÂÄãϲ»¶

» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:

×ö¼òµ¥Ê£¬Á¢¼òµ¥ÈË
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

huycwork

½ð³æ (ÖøÃûдÊÖ)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¡ï
jjdg(½ð±Ò+1): ¸Ðл²ÎÓë 2011-06-25 11:22:29
boost²»ÊÇÓÐÏֳɵÄô£¿
äöÎеÄÖÐÐÄÓÐÒ»¿é¿ÕµØ£¬¿Õ¿ÕµÄ¡£
3Â¥2011-06-25 09:00:28
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
²é¿´È«²¿ 8 ¸ö»Ø´ð

libralibra

ÖÁ×ðľ³æ (ÖøÃûдÊÖ)

æôÆï½«¾ü

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¡ï ¡ï ¡ï ¡ï ¡ï
jjdg(½ð±Ò+2): ÐÁ¿àÁË 2011-06-25 11:22:21
ÓàÔó³É(½ð±Ò+3, ³ÌÐòÇ¿Ìû+1): лл²ÎÓëÓ¦Öú£¡ 2011-06-26 00:19:14
wuyan070987(½ð±Ò+5): 2011-07-07 20:13:36
Ëæ±ãдÏÂ
CODE:
#include
using namespace std;

class Date
{
public:
    int year, month, day;

    Date()
    { this->year = this->month = this->day = 0; }

    Date(int y, int m, int d)
    {
        this->year = y;
        this->month = m;
        this->day = d;
    }

    void Show()
    {
        cout << "Date: " << this->day << "/" << this->month << "/" << this->year << endl;
    }
};

class Time
{
public:
    int hour,minute,second;

    Time()
    { this->hour = this->minute = this->second = 0; }

    Time(int h, int m, int s)
    {
        this->hour = h;
        this->minute = m;
        this->second = s;
    }

    void Show()
    {
        cout << "Time: " << this->hour << ":" << this->minute << ":" << this->second << endl;
    }
};

class DateTime : public Date, public Time
{
public:
    DateTime()
    { ; }

    DateTime(int y, int m, int d, int h, int min, int s)
    {
        this->year = y; this->month = m; this->day = d;
        this->hour = h; this->minute = min; this->second = s;
    }

    ~DateTime() {;}

    void Show()
    {
        cout << "DateTime: "
                << this->day << "/" << this->month << "/" << this->year << " "
                << this->hour << ":" << this->minute << ":" << this->second << endl;
    }
};

int main(int args, char* argv[])
{
    Date dt = Date(2011,6,25);
    Time tm = Time(10,10,10);
    DateTime dtm = DateTime(2011,6,25,10,10,10);

    dt.Show();
    tm.Show();
    dtm.Show();

    return 0;
}

½á¹û
CODE:
Date: 25/6/2011
Time: 10:10:10
DateTime: 25/6/2011 10:10:10

Process returned 0 (0x0)   execution time : 0.328 s
Press any key to continue.

matlab/VB/python/c++/Javaд³ÌÐòÇë·¢QQÓʼþ:790404545@qq.com
2Â¥2011-06-25 06:27:05
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

ҹɫÈçË®

гæ (³õÈëÎÄ̳)

¡ï
΢³¾¡¢ÃÎÏë(½ð±Ò+1): ¹ÄÀø½»Á÷£¬»¶Ó­³£À´ 2011-10-26 19:31:26
¸çÃÇΪɶ²»µ÷ÓÃtimeº¯ÊýÄØ
È»ºóÔÙ´«µÝ£¬ÕâÑùÿ´Î¶¼²»Ò»Ñù ¹þ¹þ
4Â¥2011-10-26 17:42:20
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

tingzhensun

ľ³æ (ÕýʽдÊÖ)

ÒýÓûØÌû:
Â¥: Originally posted by libralibra at 2011-06-25 06:27:05:
Ëæ±ãдÏÂ
[code] #include<iostream>
using namespace std;

class Date
{
public:
    int year, month, day;

    Date()
    { this->year = this->month = this->day = 0; }

    ...

×÷Ϊ³õѧÕߣ¬ÓÐÎÊÌâÒªÎÊ£¬¾ÍÊÇ£¬ÄúΪºÎƵ·±Ê¹ÓÃthisÖ¸Õ룬ÓÐʲôºÃ´¦

[ ·¢×ÔÊÖ»ú°æ http://muchong.com/3g ]
7Â¥2011-11-06 23:16:25
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] 085600²ÄÁÏÓ뻯¹¤ +5 °²È«Éϰ¶£¡ 2026-03-16 5/250 2026-03-18 15:33 by cmz0325
[½Ìʦ֮¼Ò] ½¹ÂÇ +8 Ë®±ùÔÂÔÂÒ°Íà 2026-03-13 12/600 2026-03-18 15:27 by ßäÎØß÷ÎØ
[¿¼ÑÐ] 311Çóµ÷¼Á +6 26ÑÐ0 2026-03-15 6/300 2026-03-18 14:43 by haxia
[¿¼ÑÐ] 085601²ÄÁϹ¤³Ìר˶Çóµ÷¼Á +6 Ľº®mio 2026-03-16 6/300 2026-03-18 14:26 by 007_lilei
[¿¼ÑÐ] 085600²ÄÁÏÓ뻯¹¤Çóµ÷¼Á +5 Ð÷ÐÒÓë×Ó 2026-03-17 5/250 2026-03-17 16:40 by laoshidan
[¿¼ÑÐ] 26¿¼ÑÐÇóµ÷¼Á +6 ؼºêSir 2026-03-13 6/300 2026-03-17 16:13 by ×íÔÚ·çÀï
[¿¼ÑÐ] ÓÐûÓеÀÌú/ÍÁľµÄÏëµ÷¼ÁÄÏÁÖ£¬¸ø×Ô¼ºÕÐʦµÜÖС« +3 TqlXswl 2026-03-16 7/350 2026-03-17 15:23 by TqlXswl
[¿¼ÑÐ] 275Çóµ÷¼Á +4 Ì«Ñô»¨ÌìÌ쿪ÐÄ 2026-03-16 4/200 2026-03-17 10:53 by ¹¦·ò·è¿ñ
[¿¼ÑÐ] 070300»¯Ñ§Ñ§Ë¶Çóµ÷¼Á +6 Ì«Ïë½ø²½ÁË0608 2026-03-16 6/300 2026-03-16 16:13 by kykm678
[¿¼ÑÐ] 085600²ÄÁÏÓ뻯¹¤ Çóµ÷¼Á +13 enenenhui 2026-03-13 14/700 2026-03-16 15:19 by ÁËÁËÁËÁË¡£¡£
[¿¼ÑÐ] 0703 ÎïÀí»¯Ñ§µ÷¼Á +3 ÎÒ¿ÉÒÔÉϰ¶µÄ¶Ô 2026-03-13 5/250 2026-03-16 10:50 by ÎÒ¿ÉÒÔÉϰ¶µÄ¶ÔÂ
[¿¼ÑÐ] ²ÄÁÏÓ뻯¹¤ 323 Ó¢Ò»+Êý¶þ+Îﻯ£¬Ò»Ö¾Ô¸£º¹þ¹¤´ó ±¾È˱¾¿ÆË«Ò»Á÷ +4 ×ÔÓɵÄ_·ÉÏè 2026-03-13 5/250 2026-03-14 19:39 by hmn_wj
[¿¼ÑÐ] ¸´ÊÔµ÷¼Á +3 ºôºô£¿~+123456 2026-03-14 3/150 2026-03-14 16:53 by WTUChen
[¿¼ÑÐ] ²ÄÁÏÓ뻯¹¤£¨0856£©304ÇóBÇøµ÷¼Á +6 Çñgl 2026-03-12 7/350 2026-03-13 23:24 by Çñgl
[¿¼ÑÐ] Ò»Ö¾Ô¸Î÷ÄϽ»´ó£¬²ÄÁÏר˶317Çóµ÷¼Á +5 lx8568 2026-03-11 5/250 2026-03-13 21:43 by peike
[¿¼ÑÐ] £¨081700£©»¯Ñ§¹¤³ÌÓë¼¼Êõ-298·ÖÇóµ÷¼Á +12 11À²À²À² 2026-03-11 35/1750 2026-03-13 21:25 by JourneyLucky
[¿¼ÑÐ] Ò»Ö¾Ô¸211»¯Ñ§Ñ§Ë¶310·ÖÇóµ÷¼Á +8 ŬÁ¦·Ü¶·112 2026-03-12 9/450 2026-03-13 15:41 by JourneyLucky
[¿¼ÑÐ] 277Çóµ÷¼Á +4 anchor17 2026-03-12 4/200 2026-03-13 11:15 by °×Ò¹ÓÆ³¤
[¿¼ÑÐ] 283Çóµ÷¼Á£¬²ÄÁÏ¡¢»¯¹¤½Ô¿É +8 ËÕ´òË®7777 2026-03-11 10/500 2026-03-13 09:06 by Linda Hu
[¿¼²©] 26¶Á²© +4 Rui135246 2026-03-12 10/500 2026-03-13 07:15 by gaobiao
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û