CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2009
    Posts
    2

    "cout <<" Problem???

    <code>
    Object M
    string computer;
    getline(cin, computer);
    cout << "Input Accepted...";
    if (computer == "") {
    cout << "Initializing List Mode...\n";
    M.run();
    } else {
    M.do(computer);
    }
    </code>
    When I run my code it will do "do" or "run" and print out "Input Accepted" afterwards. I'm not understanding why?? Thanks for any help.

    O and completely guessed on how to mark code so hope that's right.

  2. #2
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: "cout <<" Problem???

    use [] around the code word.

    Try this:
    Code:
    cout << "Initializing List Mode..." << std::endl;
    This will flush the stream cout and print immediately what you streamed to it so far. If you do not flush the stream, its content will get buffered and printed later, which in your case may be at the end of your application.

  3. #3
    Join Date
    Jun 2008
    Posts
    592

    Re: "cout <<" Problem???

    Quote Originally Posted by TommyFeticini
    O and completely guessed on how to mark code so hope that's right.
    no worries you can edit your post using the edit button on that post. the correct tags are [CODE]code here[/CODE]

    Code:
    code here
    0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
    0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000
    0000 0000 0000 0000

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured