Ohhh, cin.ignore(); goes BEFORE getline. When you suggested using cin.ignore at first, I was placing it after getline. Now it works.
Thanks! :)
Type: Posts; User: pilot1
Ohhh, cin.ignore(); goes BEFORE getline. When you suggested using cin.ignore at first, I was placing it after getline. Now it works.
Thanks! :)
Sorry about that, I didn't realize the code wouldn't compile. I'm not using VC++ at all, so that's not the problem. Here's a chunk of code from my actual program.
#include <iostream>
#include...
int main() {
vector<string> question;
cout << "Enter Question: ";
std::getline(cin, input);
question.push_back(input);
cout << "debug: question entered.";
vector<string> foo;...
Doesn't work, I still get the same output..
What should I change in the code above to make it work?
I used this code:
vector<string> question;
cout << "Enter Question: ";
std::getline(cin, input);
question.push_back(input);
cout << "debug: question entered.";
When I run the program, the...
While using "std::cin >> foo;" whenever the input includes a space, only the input before the space is stored in "foo"
How can I store an entire sentence in "foo"?
(foo is an object of type...