Hi,
The following code:
#include <iostream>
#include <string>
#include <vector>
#include <windows.h>
using namespace std;
int
main(void)
{
string sentense, words;
cout << "Enter word: ";
while (cin >> words)
sentense += words;
cout << "Sentence: " << sentense << endl;
return 0;
}
Output:
Enter word: this is a test
^Z <-- CTRL+Z 'Stream Terminator'
Sentence: thisisatest
Press any key to continue
This code works fine 100%, the problem you could be experience is the termination? istream utilises CTRL+Z on a new line inorder for the stream to terminate correctly.
Hope this helps
-Seelan