Chinaunix首页 | 论坛 | 博客
  • 博客访问: 63687
  • 博文数量: 19
  • 博客积分: 800
  • 博客等级: 准尉
  • 技术积分: 196
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-18 10:42
文章分类

全部博文(19)

文章存档

2011年(1)

2009年(8)

2008年(10)

我的朋友

分类: C/C++

2008-03-22 23:35:54

istringstream对象可以绑定一行字符串,然后以空格为分隔符把该行分隔开来。
#include
#include
using namespace std;
int main()
{
	string str, line;
	while(getline(cin, line))
	{
		istringstream stream(line);
		while(stream>>str)
			cout<测试:
input:
abc   df   e              efgeg      ffg

ouput:
abc
df
e
efgeg
ffg
阅读(1422) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~