字符流(stringstream|sscanf)


stringstream:


运行结果:

通过getline可以读取一个包含空格的字符串,通过sstream把字符串按空格进行分割。
(注意使用的时候一定不要忘了头文件#include

sscanf:


运行结果:

相关