int and string

int转string一、#include <sstream>

int n = 0;

std::stringstream ss;

std::string str;

ss<<n;

ss>>str;

二、#include <string>

to_string(num);

string转int

std::string str = "123";

int n = atoi(str.c_str());

posted @ 2017-01-03 16:13  糯米米一粒  阅读(115)  评论(0编辑  收藏  举报