PTA 顯示小孩的出生時間和姓名

2021-10-04 10:40:21 字數 927 閱讀 6659

已有類time和date,要求設計乙個派生類birthtime,它繼承類time和date,並且增加乙個資料成員childname,用於表示小孩的名字,同時設計主程式,輸入2個小孩的姓名、出生日期,並將這兩個小孩的姓名、出生日期輸出。

class time

void display()

void

display()

protected

:int hours, minutes, seconds;};

class

date

virtual

void

display()

protected

:int month, day, year;};

class

birthtime

:public date, time

public

:public

:void

show()

};intmain()

21-5-17

#include

using

namespace std;

class

time

void

display()

protected

:int hours, minutes, seconds;};

class

date

virtual

void

display()

protected

:int month, day, year;};

class

birthtime

:public date, time

void

show()

};intmain()

時間的顯示

現在有個需求是 要顯示乙個列表中每個列表項的建立時間。思路 設建立時間為create time 當前時間為now time。gap time now time create time 單位為秒數 1 如果 gap time 小於1小時 則顯示為xx分鐘前 2 如果 gap time 大於1小時 小於...

java 友好的顯示時間

1 顯示時間,30秒以內顯示剛剛 幾分鐘前顯示幾分鐘前 今天時間顯示時間,不顯示年月日 昨天時間顯示昨天 時間,不顯示年月日 昨天以前顯示具體的年月日 如下 public static string friendlydate date date if ds yd 24 60 60 1000 if e...

PHP友好的時間顯示

友好的時間展示 param int time 時間戳 param string format 預設顯示格式化方式 return string 返回時間,錯誤時返回為空字串 function diy friend date time,format y m d y date y time 年份 z da...