C++小技巧汇总

来源:互联网 发布:剑网三不合法的脸数据 编辑:程序博客网 时间:2024/06/10 04:51

// “d:\录取i.txt”改成”d:\录取‘’+i +“.txt”
string filename = “d:\录取”;
char index = i + ‘0’;//数字i转换成字符i
filename = filename + index + “.txt”;
ofile.open(filename.c_str());

int转string
int n = 0;
std::stringstream ss;
std::string str;
ss<

include “stdafx.h”

include

include

using namespace std;
void main()
{
// int 转 string
stringstream ss;
int n = 123;
string str;
ss<

原创粉丝点击