【C++FAQ】怎么输入一行字符串(可能带空格)

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
using namespace std;


int main()
{
	string str;
	while (getline(cin,str))
	{
		cout << str << endl;
	}
	return 0;
}

posted on 2011-06-24 18:27  speedmancs  阅读(474)  评论(0编辑  收藏  举报

导航