devxlogo

Tip Bank

The reverse() Algorithm

Another useful STL algorithm is reverse(). This algorithm reverses the order of elements in a specified sequence. reverse() takes two iterators that mark the sequence’s beginning and end, respectively. Here

Convert a Decimal Number to Base N

Here’s a function that converts a decimal number (base 10) to another base number system. Each digit position corresponds to a power of N, where N is a number between

A C++ Virtual Machine?

It was a question of time until a C++ virtual machine would appear. Implementing a Java-style virtual machine for C++ is a trivial task. The problem is that such a

Implement a Context Stack

Isolating the source of an error in a method containing many nested method calls can be difficult. If you haven’t written comprehensive error-handling code in every method and property you

Wrap Date Functions in a Class

I’ve been working on a class module called clsDateInfo that returns various properties of a given date, and using it in some monthly trend graphs. I had to come up

Calculating the Size of an Incomplete Array

An incomplete array declaration can appear in a function’s parameter list. For example: int count(const char s[]); The declaration of s doesn’t include the array’s size. Can count() use the

Prevent Duplicate Listbox Entries

This useful code listing prevents users from entering duplicate entries into a listbox or modifying existing listbox entries. While the code prevents users from adding duplicate entries, you can modify