This will probably be the best solution yet ;)

Compile time template metaprogramming:

template<int N>
class X : public X<N-1> {
public:
   X() { cout << N << endl; }
};

template<>
class X<0> {
};

int main() {
   X<100> obj;
   return 0;
}

I know atleast 6 other ways of achieving this besides the ones
mentioned in this thread post. :)
How many can you come up with?

On Jun 11, 8:38 pm, "/\\/a|-|a/\\/t" <mnnit.san...@gmail.com> wrote:
> use goto
>
>
>
>
>
>
>
>
>
> On Sat, Jun 11, 2011 at 8:55 PM, hary rathor <harry.rat...@gmail.com> wrote:
> > int main()
> > {
> > static int i=1;
> > int n=100;
> > if(i<=n)
> > {
> > printf("%d ",i);
> > i++;
> > main();
> > }
> > return 0;
> > }
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> regards
> /\/a|-|a/\/t
> undergraduate computer science and engineering
> mnnit allahabad

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to