私のプログラムはユーザーの入力を読み取り、簡単な「テーブル」を作成します。ユーザーは、最初に列のデータ型と行数を指定します。
ユーザーの入力:
create table
add attribute string Name
add attribute int Age
rows 3
今、ユーザーの入力から構造を準備する必要があります。私はこのようなものを持っています:
CTable
{
unsigned attributesCnt;
string * attributesNames;
void ** attributes;
};
したがって、ユーザーの入力から、プログラムは次の手順を実行します。
CTable myTable;
myTable.attributesCnt = 2; // string "Name", int "Age"
myTable.attributesNames = new string[2];
myTable.attributesNames[0] = "Name";
myTable.attributesNames[1] = "Age";
attributes = new void[2]; // 2 attributes
attributes[0] = (void*) new string[3]; // there will be 3 rows
attributes[1] = (void*) new int[3];
「attributes[0]」は文字列で、「attributes[1]」も int であることを覚えておく必要があります。
これは「正しい」方法ですか?
標準ライブラリのみを使用したい。