Generate and draw a fractal tree. To draw a fractal tree is simple: Draw the trunk At the end of the trunk, split by some angle and draw tw
Continue ReadingC++: Binary Digits
The task is to output the sequence of binary digits for a given non-negative integer. The decimal value 5, should produce an output of 101 The deci
Continue ReadingC++: Maximum Triangle Path Sum
Starting from the top of a pyramid of numbers like this, you can walk down going one step on the right or on the left, until you reach the bottom row:
Continue ReadingC++: File Input/Output
In this task, the job is to create a file called "output.txt", and place in it the contents of the file "input.txt", via an intermediate variable. In
Continue ReadingC++: Continued Fraction
A number may be represented as a continued fraction (see Mathworld for more information) as follows: The task is to write a program which gen
Continue ReadingC++: Infinity
Write a function which tests if infinity is supported for floating point numbers (this step should be omitted for languages where the language specifi
Continue ReadingC++: Execute Only Part of Loop
Quite often one needs loops which, in the last iteration, execute only part of the loop body. The goal of this task is to demonstrate the best way to
Continue ReadingC++: Entropy
Calculate the information entropy (Shannon entropy) of a given input string. Entropy is the expected value of the measure of information content in
Continue ReadingC++: Greatest Common Divisor
This task requires the finding of the greatest common divisor of two integers. Copied from least common multiple page for the sake of completeness.
Continue ReadingC++: Digital Root
The digital root, X, of a number, n, is calculated: find X as the sum of the digits of n find a new X by summing the digits of X, repeating un
Continue Reading