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 7591675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:42:35+00:00 2026-05-30T20:42:35+00:00

I thought they were the same thing, but when I sent a code to

  • 0

I thought they were the same thing, but when I sent a code to an online judge (with endl(cout)) it gave me “Wrong answer” verdict, then I tried to send another with cout << endl and the judge accepted the code! Does anyone know the difference between those commands?

  • 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-05-30T20:42:37+00:00Added an answer on May 30, 2026 at 8:42 pm

    There is none that I know of.

    std::endl is a function that take a stream and return a stream:

    ostream& endl ( ostream& os );
    

    When you apply it to std::cout, it just applies the function right away.

    On the other hand, std::basic_ostream has an overload of operator<< with the signature:

    template <typename C, typename T>
    basic_ostream<C,T>& operator<<(basic_ostream<C,T>& (*pf)(basic_ostream<C,T>&));
    

    which will also apply the function right away.

    So, technically, there is no difference, even though stream std::cout << std::endl is more idiomatic. It could be that the judge bot is simplistic though, and does not realizes it.

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

Sidebar

Related Questions

I always thought they were about the same thing but someone pointed me out
What's the difference between the following two declarations? I thought they were equivalent, but
I thought I'd seen an answer to this question before, but after searching here
I have several files that are in several different languages. I thought they were
At DevDays in SF last year (before jQuery 1.4 was released), I thought they
After I thought that I've understood how they work, I tried this: NSString *str1
I thought .Net code gets compiled into MSIL, so I always wondered how do
So everything works. But if a user has firebug's console open, they'll see a
Is this just impossible? I thought I would clean up some of my code
I've been trying to debug push notifications, but they fail silently so it's been

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.