2

I entered three inputs to the code below and got the results as follows

(1)

input: CTRL+D

result: (blank)

(2)

input: abcCTRL+D

result: (not terminated yet)

(3)

input: abc

result: abc

using namespace::std;

int main()
{

  string input;

  cin >> input;
  cout << input << endl;
  
  return 0;
}

I wonder why I should enter EOF twice to terminate the code in the second case not just only one time like the first case (it terminated immediately)

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
고9마
  • 21
  • 1

0 Answers0