mirror of
https://github.com/krahets/hello-algo.git
synced 2026-06-28 16:44:22 +00:00
Re-translate the Japanese version (#1871)
* Retranslate Japanese docs with GPT-5.4 * Retranslate Japanese code with GPT-5.4
This commit is contained in:
@@ -6,47 +6,47 @@
|
||||
|
||||
#include "./array_hash_map.cpp"
|
||||
|
||||
/* ドライバーコード */
|
||||
/* Driver Code */
|
||||
int main() {
|
||||
/* ハッシュテーブルを初期化 */
|
||||
ArrayHashMap map = ArrayHashMap();
|
||||
|
||||
/* 追加操作 */
|
||||
// キー値ペア(key, value)をハッシュテーブルに追加
|
||||
map.put(12836, "Ha");
|
||||
map.put(15937, "Luo");
|
||||
map.put(16750, "Suan");
|
||||
map.put(13276, "Fa");
|
||||
map.put(10583, "Ya");
|
||||
cout << "\nAfter adding, the hash table is\nKey -> Value" << endl;
|
||||
// ハッシュテーブルにキーと値のペア (key, value) を追加
|
||||
map.put(12836, "シャオハー");
|
||||
map.put(15937, "シャオルオ");
|
||||
map.put(16750, "シャオスワン");
|
||||
map.put(13276, "シャオファー");
|
||||
map.put(10583, "シャオヤー");
|
||||
cout << "\n追加完了後、ハッシュテーブルは\nKey -> Value" << endl;
|
||||
map.print();
|
||||
|
||||
/* クエリ操作 */
|
||||
// ハッシュテーブルにキーを入力、値を取得
|
||||
/* 検索操作 */
|
||||
// キー key をハッシュテーブルに渡し、値 value を取得
|
||||
string name = map.get(15937);
|
||||
cout << "\nEnter student ID 15937, found name " << name << endl;
|
||||
cout << "\n学籍番号 15937 を入力すると、氏名 " << name << endl;
|
||||
|
||||
/* 削除操作 */
|
||||
// ハッシュテーブルからキー値ペア(key, value)を削除
|
||||
// ハッシュテーブルからキーと値のペア (key, value) を削除
|
||||
map.remove(10583);
|
||||
cout << "\nAfter removing 10583, the hash table is\nKey -> Value" << endl;
|
||||
cout << "\n10583 を削除した後、ハッシュテーブルは\nKey -> Value" << endl;
|
||||
map.print();
|
||||
|
||||
/* ハッシュテーブルを走査 */
|
||||
cout << "\nTraverse key-value pairs Key->Value" << endl;
|
||||
cout << "\nキーと値のペア Key->Value を走査" << endl;
|
||||
for (auto kv : map.pairSet()) {
|
||||
cout << kv->key << " -> " << kv->val << endl;
|
||||
}
|
||||
|
||||
cout << "\nIndividually traverse keys Key" << endl;
|
||||
cout << "\nキー Key のみを走査" << endl;
|
||||
for (auto key : map.keySet()) {
|
||||
cout << key << endl;
|
||||
}
|
||||
|
||||
cout << "\nIndividually traverse values Value" << endl;
|
||||
cout << "\n値 Value のみを走査" << endl;
|
||||
for (auto val : map.valueSet()) {
|
||||
cout << val << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user