int,float,double 同理。
#include <sstream> #include <string> int main(){ double num; string str = "123.45"; stringstream ss; ss << str; ss >> num; return 0 }