c++ int和string类型转换

int 转 string

#include 
#include 

string s;
int num = 15;
stringstream ss;
ss<<num;
ss>>s;

string 转 int

string temp = str;
int num = atoi(temp.c_str());

你可能感兴趣的:(C++)