@Divye Kapoor : It was interesting...use of inheritance concept to print
that...
On Mon, Jun 13, 2011 at 12:09 AM, Divye Kapoor <[email protected]>wrote:
> 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" <[email protected]> wrote:
> > use goto
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Sat, Jun 11, 2011 at 8:55 PM, hary rathor <[email protected]>
> 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 [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected].
> > > 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.