It is often useful to control the memory layout of fields in a data structure to match an interface control definition, or to interface with hardware.
Continue ReadingC++: Luhn Test of Credit Card Numbers
The Luhn test is used by some credit card companies to distinguish valid credit card numbers from what could be a random selection of digits. Those
Continue ReadingC++: Input/Output for Pairs of Numbers
From lines of input starting with a line containing the numbers of pairs to follows, followed by that number of pairs of integers separated by a space
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 ReadingCppCon 2014: Herb Sutter “Back to the Basics! Essentials of Modern C++ Style”
https://www.youtube.com/watch?v=xnqTKD8uD64
Continue ReadingC++: Sort a Range of Elements
On line 8, we create a std::array of ints that we wish to sort. On line 10, we call the standard alrogithm std::sort, which sorts the range of elem
Continue ReadingC++: What is the name of the “–>” operator?
After reading Hidden Features and Dark Corners of C++/STL on comp.lang.c++.moderated, I was completely surprised that it compiled and worked in both V
Continue ReadingC++: Last Friday of Each Month
Write a program or a script that returns the last Fridays of each month of a given year. The year may be given through any simple input method in y
Continue ReadingC++: Hickerson Series of Almost Integers
The following function, due to D Hickerson, is said to generate "Almost integers" by the "Almost Integer" page of Wolfram Mathworld. (December 31 2013
Continue ReadingThe Almighty Dollar: Distribution of Income by Religion
SOURCE
Continue Reading