Skip to content

Instantly share code, notes, and snippets.

@tdkn
Created September 2, 2012 14:38
Show Gist options
  • Save tdkn/3599689 to your computer and use it in GitHub Desktop.
Save tdkn/3599689 to your computer and use it in GitHub Desktop.
C++宿題 chapter11-12
■第11章 <錬成問題>
(01) メンバ
(02) Build
(03) コンストラクタ
(04) メンバ
(05) a) ある
(06) Build
(07) Build
(08) ・クラス宣言の書き方
・アクセス指定子の書き方
・kouzaオブジェクトの定義の書き方
・メンバ関数kouza_noとyokingakuの戻り値
・お金の引き出しはメンバ関数であるorosu()を使うべきである
・口座番号の値はメンバ関数であるkouza_no()で取得するべきである
・預金額の値はメンバ関数であるyokingaku()で取得するべきである
■第12章 <錬成問題>
(01) デフォルト
(02) const
(03) ostream& operator<<(ostream& s, const Date& x)
{
return( s << setfill('0')
<< setw(4) << x.Year() << "年"
<< setw(2) << x.Month() << "月"
<< setw(2) << x.Day() << "日" );
}
(04) ○
(05) ○
(06) ○
(07) ○
(08) ×
(09) ○
(10) ×
(11) ○
(12) Date
(13) Build
(14) this
(15) Build
(16) birth(y, m, d)
(17) Build
(18) Age
(19) {
time_t now;
struct tm* local;
time(&now);
local = localtime(&now);
long int age = 0;
age += (local->tm_year + 1900 - birth.Year()) * 10000;
age += (local->tm_mon + 1 - birth.Month()) * 100;
age += local->tm_mday - birth.Day();
return (age/10000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment