いろんな言語で宿題スレ
■ このスレッドは過去ログ倉庫に格納されています
0701デフォルトの名無しさん
2009/09/21(月) 15:50:07# [1] 授業単元:アルゴリズム c++
# [2] 問題文(含コード&リンク):
# http://ime.nu/kansai2channeler.hp.infoseek.co.jp/cgi-bin/joyful/img/9950.zip
# STLのベクタークラスを改良したクラスを実装する課題。
# 【意訳】Chainというクラスを作りなさい。Chainクラスは[2 7 -1 43]のように
# 色々なデータタイプの配列です。
# (上記はintの場合)
# STLのVectorに似たクラスをつくるのがこのプロジェクトの目的です。
# 以下の操作とそれに追随するアウトプットが行えるようにするのがゴールです。
# chain<int> a, b; // Two empty chains are created
# cout << a.length() << endl; // yields 0
# cin >> a; // User types [2 3 7]
# cout << a; // Output is [2 3 7]
# cin >> b; // User types [8 4 2 1]
# cout << a+b << endl; // Output is [2 3 7 8 4 2 1]
# cout << a+5 << endl; //Output is [2 3 7 5]
# a+=6; // a is now [2 3 7 6]
# cout << a[1] << endl; //Should printout 3
# chain<int> c(3*a); // c is initialized to
# // [2 3 7 6 2 3 7 6 2 3 7 6]
■ このスレッドは過去ログ倉庫に格納されています