25
7
Following this popular question, present your solution which prints the numbers 1 to 1000 (all of them, not the string "1 to 1000" verbatim or something funny) in C++ without using any semi-colons. Unlike the original question, you may use conditionals and loops.
Solutions not requiring any compiler flags are preferred. Please mention any you use if you go against this. Undefined behaviour is allowed, so please specify the compiler and version you're using. Preference will be given to clever solutions. This is not a shortest code contest.
(I have a solution, which I'll post in 24 hours if a similar solution isn't posted before then.)
Y CAnt use constructors since the question actually wants us to answer in c++ ..create 1000 objects ...everytime constructor gets called i++ ?? :) – None – 2012-12-12T08:21:10.933
@marcog: But show us your solution, please. I'm very interested on it. – Jack – 2013-01-03T19:22:32.687
5what about your solution? – Quixotic – 2011-03-09T00:15:56.123
@Deb The if condition in my statement evaluated to false. :) – marcog – 2011-03-10T07:45:41.107
@macrog:May I know which of the solution makes that evaluation? :-) – Quixotic – 2011-03-10T19:07:53.063
There is also a similar task in SPOJ which require you to code without semicolon.
– Quixotic – 2011-03-10T19:11:24.790I would laugh one day if this question was asked for scala. – Mikaël Mayer – 2014-01-29T23:10:49.537