#include "iostream"
#include "vector"
#include "string"
#include "stack"
using namespace std;
#define buffer 1014;
int main(){
int n = 3, i = 0;
string str;
getline(cin, str);
cout<<str;
return 0;
/*
//输入一组字符串包括空格照常输入, 这是在char数组下. cin.getline() 与 cin>>str 的一个不同是,
//前者输入一行,行中可以包含空格,后者却以空格或回车作为字串结束,接收不包含空格。
char str[128];
cin.getline(str, sizeof(str));
cout << str <<endl;
return 0;
*/
/*
//char 数组下,以X为分界,接收两次;
//input: ai X han xue
//output: ai
//second line : han xue
char str[128];
cout<<"please input text and enter: "<<endl;
cin.getline(str, sizeof(str), 'X');
cout<<"you typed first line: " <<str<<endl;
cin.getline(str, sizeof(str));
cout<<"second line :" <<str<<endl;
*/
}
部分内容来自 http://blog.csdn.net/lyac2006/article/details/1565556