• Hellfire103@lemmy.caOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      22 days ago

      Instead of this:

      cout << "Hello world.\n";
      

      You can do this:

      cout << "Hello world." << endl;
      
      • Daedskin@lemm.ee
        link
        fedilink
        arrow-up
        1
        ·
        21 days ago

        The fact that you used the namespace for cout but not for endl inordinately bothers me

    • vapeloki@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      22 days ago

      std::endl is used in output streams in C++ to end the line, using the os specific line termination sequence, and flush the buffer.

      The later one is a performance issue in many cases, why the use of "\n" is considered preferred

        • ClemaX@lemm.ee
          link
          fedilink
          arrow-up
          1
          ·
          22 days ago

          It is the stream itself that is buffered, so the terminal does not handle the contents until the stream is flushed.