StringStream

  • + 0 comments

    They are basically going through each character and reprinting it; however, whenever they come to a comma, they instead print a '\n', creating the new line.

    cout << (c != ',' ? c : '\n') takes advantage of the ternary operator x ? y : z, which follows the process of validating x, and passing back y if it is true, or z if it is not. It basically rewrites "44,23,45" as "44\n23\45".

    Read more on the Ternary Operator.