fork download
  1. #include <iostream>
  2. #include <random>
  3. #include <cstdint>
  4. #include <codecvt>
  5. #include <string>
  6.  
  7.  
  8.  
  9. int main() {
  10. std::random_device rd;
  11. std::minstd_rand mr(0);
  12. std::uniform_int_distribution<> UI(0, 5);
  13.  
  14. std::u32string S = U"⚀⚁⚂⚃⚄⚅";
  15.  
  16. auto L = std::wcout.imbue(std::locale("ja_JP.UTF-8"));
  17. std::wcout << "Dice Show to " << S[UI(mr)] << std::endl;
  18. std::wcout.imbue(L);
  19.  
  20. return 0;
  21. }
  22.  
  23. /** /
  24. int main() {
  25.  
  26. std::u32string S = U"⚀⚁⚂⚃⚄⚅";
  27.  
  28. // setlocale(LC_ALL, "Japanese");
  29. // setlocale(LC_CTYPE, "ja_JP.UTF-8");
  30. // auto L = std::wcout.imbue(std::locale("Japanese"));
  31. auto L = std::wcout.imbue(std::locale("ja_JP.UTF-8"));
  32. std::wcout << "Dice Show to " << S[0] << std::endl;
  33. std::wcout.imbue(L);
  34.  
  35. //std::cout << L"DIce Show to " << S[0] << std::endl;
  36. }
  37. /**/
  38.  
  39. /** /
  40. int main() {
  41. //std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> cvt;
  42. //char D[6][5] = { u"⚀",u8"⚁",u8"⚂",u8"⚃",u8"⚄",u8"⚅" };
  43. //char32_t D[6][2] = { U"⚀",U"⚁",U"⚂",U"⚃",U"⚄",U"⚅" };
  44. std::u32string S = U"⚀⚁⚂⚃⚄⚅";
  45.  
  46.  
  47.  
  48.  
  49.  
  50. // auto L = std::wcout.imbue(std::locale("Japanese"));
  51.  
  52. // std::wcout << L"DIce Show to " << D[UI(mr)] << std::endl;
  53. std::wcout << L"DIce Show to " << S[0] << std::endl;
  54. // std::cout << L"DIce Show to " << D[0] << std::endl;
  55. // std::wcout.imbue(L);
  56.  
  57. return 0;
  58. }
  59. /**/
Runtime error #stdin #stdout #stderr 0s 16880KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid