If you write to a text (as opposed to binary) stream, \n produces \n or \r\n (or \r if old enough) depending on platform just fine.
Nobody should be using C++ anyway, but plenty of languages have silly system newline constants, which do nothing useful.