====== String to integer & integer to string ====== ===== String to integer ===== int str2int (const std::string &str) { std::stringstream ss(str); int n; ss >> n; return n; } ===== Integer to string ===== string int2str (int n) { std::stringstream ss; ss << n; return ss.str(); }