Files
hello-algo/ru/codes/cpp/chapter_hashing/built_in_hash.cpp
Yudong Jin 772183705e Add ru version (#1865)
* Add Russian docs site baseline

* Add Russian localized codebase

* Polish Russian code wording

* Update ru code translation.

* Update code translation and chapter covers.

* Fix pythontutor extraction.

* Add README and landing page.

* placeholder of profiles

* Use figures of English version

* Remove chapter paperbook
2026-03-28 04:24:07 +08:00

30 lines
1.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* File: built_in_hash.cpp
* Created Time: 2023-06-21
* Author: krahets (krahets@163.com)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
int num = 3;
size_t hashNum = hash<int>()(num);
cout << "Хеш-значение целого числа " << num << " = " << hashNum << "\n";
bool bol = true;
size_t hashBol = hash<bool>()(bol);
cout << "Хеш-значение булева значения " << bol << " = " << hashBol << "\n";
double dec = 3.14159;
size_t hashDec = hash<double>()(dec);
cout << "Хеш-значение десятичного числа " << dec << " = " << hashDec << "\n";
string str = "Hello Algo";
size_t hashStr = hash<string>()(str);
cout << "Хеш-значение строки " << str << " = " << hashStr << "\n";
// В C++ встроенный std::hash() предоставляет вычисление хеша только для базовых типов данных
// Вычисление хеша для массивов и объектов нужно реализовывать самостоятельно
}