Search:

Type: Posts; User: pilot1

Search: Search took 0.00 seconds.

  1. Ohhh, cin.ignore(); goes BEFORE getline. When...

    Ohhh, cin.ignore(); goes BEFORE getline. When you suggested using cin.ignore at first, I was placing it after getline. Now it works.
    Thanks! :)
  2. Sorry about that, I didn't realize the code...

    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...
  3. int main() { vector question; ...

    int main() {
    vector<string> question;
    cout << "Enter Question: ";
    std::getline(cin, input);
    question.push_back(input);
    cout << "debug: question entered.";
    vector<string> foo;...
  4. Doesn't work, I still get the same output.. What...

    Doesn't work, I still get the same output..
    What should I change in the code above to make it work?
  5. I used this code: vector question;...

    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...
  6. make std::cin store more than 1 word in a string?

    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...
Results 1 to 6 of 6