Hi, I am new to C++. I am trying to create a vector that can hold strings. I have a while (cin >> entry) statement to capture all string inputs in a vector container, but when I hit Ctrl-D, it does not get an EOF signal... If I change the type to int, it works. Any thoughts ?
#include <iostream>
#include <string>
#include <iomanip>
#include <ios>
#include <algorithm>
#include <vector>
usingnamespace std;
int main() {
cout << "This program counts the number of times distinct words appear in an input" << endl;
vector<string> input;
string entry;
cout << "Enter strings: ";
while (cin >> entry) {
input.push_back(entry);
}
// it stops working here ... I should be able to ctrl-d for EOF
cout << "bye ...";
return 0;
}