gpt4 book ai didi

c++ - 编写抽象函数将整数转换为字符串

转载 作者:行者123 更新时间:2023-11-27 23:30:40 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Easiest way to convert int to string in C++

class MyInteger
{
MyInteger() : m_val(0) { }
MyInteger()( int _val ) : m_val( _val ) {}
~MyInteger() {}
};

MyInteger myInteger(10);
std::string s = (std::string)myInteger

如何编写 C++ 函数来获取 s 中的“10”?我是 C++ 新手。

非常感谢。

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