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

wuyan070987

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

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

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

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

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

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

» ²ÂÄãϲ»¶

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

×ö¼òµ¥Ê£¬Á¢¼òµ¥ÈË
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢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µÄ»ØÌû
²é¿´È«²¿ 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µÄ»ØÌû

huycwork

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

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

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

ҹɫÈçË®

гæ (³õÈëÎÄ̳)

¡ï
΢³¾¡¢ÃÎÏë(½ð±Ò+1): ¹ÄÀø½»Á÷£¬»¶Ó­³£À´ 2011-10-26 19:31:26
¸çÃÇΪɶ²»µ÷ÓÃtimeº¯ÊýÄØ
È»ºóÔÙ´«µÝ£¬ÕâÑùÿ´Î¶¼²»Ò»Ñù ¹þ¹þ
4Â¥2011-10-26 17:42:20
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] 070300»¯Ñ§319Çóµ÷¼Á +5 ½õÀð0909 2026-03-17 5/250 2026-03-18 10:21 by macy2011
[¿¼ÑÐ] ÉúÎïѧ071000 329·ÖÇóµ÷¼Á +3 ÎÒ°®ÉúÎïÉúÎﰮΠ2026-03-17 3/150 2026-03-18 10:12 by macy2011
[¿¼ÑÐ] 288Çóµ÷¼Á£¬Ò»Ö¾Ô¸»ªÄÏÀí¹¤´óѧ071005 +3 ioodiiij 2026-03-17 3/150 2026-03-18 09:58 by Çóµ÷¼Ázz
[¿¼ÑÐ] 301Çóµ÷¼Á +9 yyÒªÉϰ¶Ñ½ 2026-03-17 9/450 2026-03-18 08:58 by Î޼ʵIJÝÔ­
[¿¼ÑÐ] 278Çóµ÷¼Á +5 ÑÌ»ðÏÈÓÚ´º 2026-03-17 5/250 2026-03-18 08:43 by ÐÇ¿ÕÐÇÔÂ
[¿¼ÑÐ] 296Çóµ÷¼Á +5 ´ó¿Ú³Ô·¹ ÉíÌ彡 2026-03-13 5/250 2026-03-17 21:05 by ²»»ó¿ÉÀÖ
[¿¼ÑÐ] 211±¾£¬11408Ò»Ö¾Ô¸ÖпÆÔº277·Ö£¬ÔøÔÚÖпÆÔº×Ô¶¯»¯Ëùʵϰ +6 Losir 2026-03-12 7/350 2026-03-17 12:09 by danranxie
[¿¼ÑÐ] Ò»Ö¾Ô¸£¬¸£ÖÝ´óѧ²ÄÁÏר˶339·ÖÇóµ÷¼Á +3 ľ×ÓmomoÇàÕù 2026-03-15 3/150 2026-03-17 07:52 by laoshidan
[»ù½ðÉêÇë] ½ñÄêµÄ¹ú»ù½ðÊÇ´ò·ÖÖÆÂ𣿠50+3 zhanghaozhu 2026-03-14 3/150 2026-03-16 17:07 by ±±¾©À³ÒðÈóÉ«
[¿¼ÑÐ] 304Çóµ÷¼Á +3 ÂüÊâ2266 2026-03-14 3/150 2026-03-16 16:39 by houyaoxu
[¿¼ÑÐ] 285Çóµ÷¼Á +6 ytter 2026-03-12 6/300 2026-03-16 15:05 by njzyff
[¿¼ÑÐ] ²ÄÁÏÓ뻯¹¤Ò»Ö¾Ô¸Äϲý´óѧ327Çóµ÷¼ÁÍÆ¼ö +7 Ncdx123456 2026-03-13 8/400 2026-03-16 12:15 by karry wen
[¿¼ÑÐ] 22408×Ü·Ö284Çóµ÷¼Á +3 InAspic 2026-03-13 3/150 2026-03-15 11:10 by zhq0425
[¿¼ÑÐ] 294Çóµ÷¼Á +3 Zys010410@ 2026-03-13 4/200 2026-03-15 10:59 by zhq0425
[¿¼ÑÐ] Çóµ÷¼Á£¨²ÄÁÏÓ뻯¹¤327£© +4 °®³ÔÏã²ËÀ² 2026-03-11 4/200 2026-03-13 22:11 by JourneyLucky
[¿¼ÑÐ] Ò»Ö¾Ô¸Î÷ÄϽ»´ó£¬²ÄÁÏר˶317Çóµ÷¼Á +5 lx8568 2026-03-11 5/250 2026-03-13 21:43 by peike
[¿¼ÑÐ] 281Çóµ÷¼Á +9 Koxui 2026-03-12 11/550 2026-03-13 20:50 by Koxui
[¿¼ÑÐ] ¹¤¿Æ278·ÖÇóµ÷¼Á +5 ÖÜÂýÈȰ¡ 2026-03-12 7/350 2026-03-13 15:49 by JourneyLucky
[¿¼ÑÐ] ¹¤¿Æµ÷¼Á +4 Jiang191123£¡ 2026-03-11 4/200 2026-03-13 15:15 by Miko19
[¿¼ÑÐ] 321Çóµ÷¼Á£¨Ê³Æ·/ר˶£© +3 xc321 2026-03-12 6/300 2026-03-13 08:45 by xc321
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û