Assume 'int' range value is 0 to 65535

int nCount =65535;
++nCount; //now nCount is zero

Is something like above what you are looking for?

class ModuloCounter
{
public:
     void Increment();

private:
     unsigned int m_nCount;
}

void ModuloCounter::Increment()
{
    if (m_nCount >= THE_VALUE_YOU_WANT)
    {
         m_nCount = 0;
    }
}

you can use operator ++ instead of function Increment()

But because this is so simple and straightforward, I guess this is not
what you are looking for :)

Merry Xmas
- ananth

On Tue, 28 Dec 2004 12:15:07 -0000, Alvin David Morris
<[EMAIL PROTECTED]> wrote:


>  Thanks for all the help.... you guys cleared a few things up a but
>  for me.... but here is my real challenge and I'm in a bit of a jam
>  with it....

>  I have to design an ADT for a modulo counter. a modulo counter is a
>  counter that can cout up. when counting up, if the counter reaches
>  its maimum value, the counter wraps back around to zero, it wraps
>  around to the maximum value. Give the class declaration for my ADT.

>  I'm not asking for anyone to do it for me... I'm just in a bit of a
>  jam over it.... I've read the chapter on ADT's and such... again and
>  again... still don't really get it.... I hate that text book....

>  Thanks again for all your help :)

>  Alvin








>
>  To unsubscribe, send a blank message to
> <mailto:[EMAIL PROTECTED]>.
>


>  Yahoo! Groups Sponsor

>  ADVERTISEMENT


>  ________________________________
>  Yahoo! Groups Links

> To visit your group on the web, go to:
> http://groups.yahoo.com/group/c-prog/
>  
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>  
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to