pri*_*nce 1 c++ namespaces ostringstream
所以我想将一个整数转换成一个字符串但是使用itoa不是标准的,所以通过我的研究我认为最好的方法是使用OStringStream.这是一些伪代码:
#include <iostream>
#include <cmath>
#include <cstdlib>
std::string plusMinus(int x) {
std::ostringstream x_str;
// more code here obviously
}
int main(int argc, const char * argv[])
{
// some cin/cout functions here
}
Run Code Online (Sandbox Code Playgroud)
我在"std :: ostringstream"上遇到错误:"未定义模板的隐式实例化".这是什么意思?我尝试在顶部放置"using namespace std;"但它没有任何效果.
| 归档时间: |
|
| 查看次数: |
695 次 |
| 最近记录: |