we can declare a class with construction printing value

class A
{
private:
static int i;
public:
A()
{
cout<<++i <<endl;
}
};
A::i=0;
main()
{
int n=5;
A ob[n];
}
this will print from 1 to 5

am i right?

On Fri, Jun 10, 2011 at 9:30 PM, Navneet Gupta <navneetn...@gmail.com>wrote:

> Using recursion would be like using loops only. Also i believe the
> recursion used would be tail recursion and one can change tail recursion to
> loop based non recursive method.
>
> Okay, giving all a hint. Think classes and objects.
>
>
> On Fri, Jun 10, 2011 at 9:26 PM, Navneet Gupta <navneetn...@gmail.com>wrote:
>
>> No.
>>
>>
>> On Fri, Jun 10, 2011 at 9:26 PM, nagajyothi gunti <
>> nagajyothi.gu...@gmail.com> wrote:
>>
>>>
>>> Can "goto" statement be used?
>>>
>>> On Fri, Jun 10, 2011 at 11:42 AM, Navneet Gupta 
>>> <navneetn...@gmail.com>wrote:
>>>
>>>> Take n from user and print 1 to n. No loops like for/while/do-while are
>>>> allowed to use.
>>>>
>>>> --Navneet
>>>>
>>>>  --
>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> Jyothi
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> --Navneet
>>
>>
>
>
> --
> --Navneet
>
>  --
> 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.
>



-- 
.... radhika .. :)

-- 
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