int与string类型转换

1、int>string

int m1 = 1;
std::stringstream ss1;
std::string str1;
ss1<<m1;
ss1>>str1;

2、string>int

std::string str1 = " ";
int m1 = atoi(str1.c_str());

你可能感兴趣的:(类型转换,String,int)