Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8684929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:25:51+00:00 2026-06-12T22:25:51+00:00

Please consider the code below: vector<__int64> vNumbers; copy(istream_iterator<__int64>(cin), istream_iterator<__int64>(), back_inserter(vNumbers)); If I’ll enter 1

  • 0

Please consider the code below:

vector<__int64> vNumbers;   
copy(istream_iterator<__int64>(cin), istream_iterator<__int64>(), back_inserter(vNumbers));

If I’ll enter 1 23 45 and press Enter the vector will be filled with 45, 23, 1, numbers.
Now a simple question. How can I change the code so that if I press Enter and enter new numbers the numbers were added to the vector too? In other words how to configure end of stream iterator?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:25:52+00:00Added an answer on June 12, 2026 at 10:25 pm

    The problem you have is that the stream reads as far as it can without blocking again. As soon as you press [Enter], stdin gets flushed by the operating system (in some cases, not in all cases). The stream reads until EOF or until there is nothing to be read anymore. This is what occurs on every flush (bunch of new data available at once).

    That’s why different people observe different behaviour. As soon as you pipe a file into the stream, it will have the whole file available at once and only stop at the end of the file. The newlines is just whitespace to the stream, alike spaces and tab.

    You cannot solve this problem without controlling the input at a lower level.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello Please consider the code snippets below compiled with gcc on a Linux machine(64bit)
Please consider the below piece of code: HashSet hs = new HashSet(); hs.add(hi); --
A bit of help please, consider the bit of code below. public class Widget
please consider the code below, and tell me what I'm doing wrong. I want
Now please consider my below code of android layout <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
Please Consider my below xml code and screen shot(To view the large screen shotplease
A sample problem asks us to consider the code below and predict what will
Please, consider the code sample below, and focus on variable assignments. Since I have
Please, consider the code below: template<typename T> bool function1(T some_var) { return true; }
please consider this code : 1-... 2-{ 3-... 4-SqlConnection cn=new SqlConnection(); 5-... 6-} if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.