unsigned long stringToNum(const string& str) //string 到数字
{
istringstream iss(str);
unsigned long num;
iss >> num;
return num;
}
string numToString(unsigned long d) { //数字到string
stringstream ss;
ss <<std::fixed<< d;\\write floating-point values in fixed-point notation.可以用std::cout.precision(5);设置位数
return ss.str();
}
网友评论