We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
ss.ignore() ignores the next character (in this case that'd be a comma). It "looks like" doing ++i, since ss goes to the next character. I think it's bad coding style. ignore() is actually a function that takes an optional parameter (that defaults to 1) telling how many characters to ignore. It'd be better to write ss.ignore(1).
Also, i=0 is useless since i gets assigned right after in the condition section ss>>i.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
StringStream
You are viewing a single comment's thread. Return to all comments →
ss.ignore()
ignores the next character (in this case that'd be a comma). It "looks like" doing++i
, since ss goes to the next character. I think it's bad coding style.ignore()
is actually a function that takes an optional parameter (that defaults to 1) telling how many characters to ignore. It'd be better to writess.ignore(1)
.Also,
i=0
is useless sincei
gets assigned right after in the condition sectionss>>i
.