gpt4 book ai didi

c++ - 如何获取字符串输出的宽度?

转载 作者:行者123 更新时间:2023-11-30 04:52:29 26 4
gpt4 key购买 nike

<分区>

考虑

#include <string>
#include <iostream>

int main()
{
std::string test="αλφα";
std::cout << "size() of '" << test << "' = " << test.size() << std::endl;
}

产生

size() of 'αλφα' = 8

我如何使用 C++ 标准库找到通过写入字符串(即上例中的 4)生成的输出宽度?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com