• 基础知识之C++篇


    //-----------------------------------------------------------------
    // 计算 hash 值,返回的 hash 值数据类型是 uint64_t
    #include <iostream>
    #include <string>
    #include <functional>
     
    int main()
    {
        std::string s = "Stand back! I've got jimmies!";
        std::cout << std::hash<std::string>{}(s) << ' ';
    }
     
    //-----------------------------------------------------------------------------
    // 功能1:给字符串添加双引号和斜杠
    // 功能2:剔除字符串中的双引号和斜杠
    #include <iostream>
    #include <iomanip>
    #include <sstream>
     
    int main()
    {
        std::stringstream ss;
        std::string in = "String with spaces, and embedded "quotes" too";
        std::string out;
     
        // 给字符串添加双引号和斜杠
        ss << std::quoted(in);

        // 剔除字符串中的双引号和斜杠
        ss >> std::quoted(out);
    }
    //----------------------------------------------------------------------------
    // std::setw() 设置缩进字符数量
    // std::setfill() 设置缩进字符
    std::cout << std::setw(4<< j_object << " ";
    std::cout << std::setw(2<< j_array << " ";
    std::cout << std::setw(1<< std::setfill(' '<< j_object << " ";
     
    //----------------------------------------------------------------------------
    // 获取 CPU 硬核数量
    int max_thread_num = std::thread::hardware_concurrency();

  • 相关阅读:
    LeetCode 728. Self Dividing Numbers
    LeetCode 400. Nth Digit
    LeetCode 326. Power of Three
    LeetCode 263. Ugly Number
    LeetCode 258. Add Digits
    详解 CSS 属性
    tr:hover变色的问题
    Java包(package)的命名规范
    javascript中的后退和刷新
    cannot be resolved to a type 错误解决方法
  • 原文地址:https://www.cnblogs.com/micemik/p/12254635.html
Copyright © 2020-2023  润新知