挺有意思的字符分割 string A = "1,2,3,4,5,6,7,8"; istringstream is(A); string temp; while (getline(is,temp,',')) { cout<<atoi(temp.c_str())<<endl; } 你们都怎么搞呢