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++: Align Columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of
Continue ReadingC++: Increment a Numerical String
This task is about incrementing a numerical string. // standard C++ string stream operators #include <cstdlib> #include <string> #in
Continue ReadingC++: FASTA Format
In bioinformatics, long character strings are often encoded in a format called FASTA. A FASTA file can contain several strings, each identified by a n
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++: 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 ReadingWhy is processing a sorted array faster than an unsorted array?
Here is a piece of C++ code that seems very peculiar. For some strange reason, sorting the data miraculously makes the code almost six times faster.
Continue ReadingC++: IBAN
The International Bank Account Number (IBAN) is an internationally agreed means of identifying bank accounts across national borders with a reduced ri
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 Reading




