I am the developer of some family tree software (written in C++ and Qt). I had no problems until one of my customers mailed me a bug report. The probl
Continue ReadingC++: Define a Primitive Data Type
Demonstrate how to define a type that behaves like an integer but has a lowest valid value of 1 and a highest valid value of 10. Include all bounds ch
Continue ReadingC++: Include a File
The task is to demonstrate the language's ability to include source code from other files. In C and C++, inclusion of other files is achieved via a
Continue ReadingC++: Function Composition
Create a function, compose, whose two arguments f and g, are both functions with one argument. The result of compose is to be a function of one argume
Continue ReadingC++: Closest-Pair Problem
The aim of this task is to provide a function to find the closest two points among a set of given points in two dimensions, i.e. to solve the Closest
Continue ReadingC++: Multiple Distinct Objects
Create a sequence (array, list, whatever) consisting of n distinct, initialized items of the same type. n should be determined at runtime. By disti
Continue ReadingC++: Anonymous Recursion
While implementing a recursive function, it often happens that we must resort to a separate "helper function" to handle the actual recursion. This
Continue ReadingC++: Compile-Time Calculation
Some programming languages allow calculation of values at compile time. For this task, calculate 10! at compile time. Print the result when the progra
Continue ReadingC++: Hailstone Sequence
The Hailstone sequence of numbers can be generated from a starting positive integer, n by: If n is 1 then the sequence ends. If n is even then
Continue ReadingC++: Check That File Exists
In this task, the job is to verify that a file called "input.txt" and the directory called "docs" exist. This should be done twice: once for the curre
Continue Reading




