Skip to main content
10 events
when toggle format what by license comment
Mar 15, 2016 at 13:54 comment added janos @Mast I agree it's a bad idea (and that explains the downvotes), but it's still an answer.
Mar 15, 2016 at 13:25 comment added Mast @janos You're right about the ternary operator being a valid recommendation, my bad. I'm aware provided code will work in C++, but it's a bad thing to recommend when a beginner is learning C++. OP is on the right track, I can imagine this answer being most confusing for a beginner. For instructions on how to ternary on cout (you shouldn't): see this SO answer.
Mar 15, 2016 at 11:45 comment added janos Hi @Mast, this will work fine in C++ too, it's just not idiomatic. But that's not the point. The point is recommending the ternary operator, and an example to illustrate the point. It's not a great answer but it's an answer.
Mar 15, 2016 at 11:22 comment added Mast Telling a beginner to write C while learning C++ is a bad idea. This is not an answer, it's an alternative implementation at best. This does not review the code given by the OP.
Mar 15, 2016 at 11:21 review Low quality posts
Mar 15, 2016 at 11:43
Mar 6, 2016 at 17:58 comment added Jamal Regardless, that still doesn't look very readable, so an if may be preferred.
Mar 6, 2016 at 17:55 history edited Jamal CC BY-SA 3.0
deleted 7 characters in body
Mar 6, 2016 at 17:50 review First posts
Mar 6, 2016 at 18:34
Mar 6, 2016 at 17:47 comment added Arif Burhan I don't know enough about C++ to implement this using cout.
Mar 6, 2016 at 17:46 history answered Arif Burhan CC BY-SA 3.0