According to the C++11 standard, what is the output of this program? template <class T> void f(T &i) { std::cout << 1; } templ
Continue ReadingC++: Linear Congruential Generator
The linear congruential generator is a very simple example of a random number generator. All linear congruential generators use this formula:
Continue ReadingC++: Letter Frequency
Open a text file and count the occurrences of each letter. Some of these programs count all characters (including punctuation), but some only count
Continue ReadingC++: Integer Sequence
Create a program that, when run, would display all integers from 1 to ∞ (or any relevant implementation limit), in sequence (i.e. 1, 2, 3, 4, etc) i
Continue ReadingC++: I Before E Except After C
The phrase "I before E, except after C" is a widely known mnemonic which is supposed to help when spelling English words. Task Description
Continue ReadingC++: Fibonacci Word Fractals
The Fibonacci word may be represented as a fractal as described here: For F_wordm start with F_wordCharn=1 Draw a segment forward If curren
Continue ReadingC++: Break OO Privacy
Show how to access private or protected members of a class in an object-oriented language from outside an instance of the class, without calling non-p
Continue ReadingC++: Base64 Encode Data
Convert an array of bytes or binary string to the base64-encoding of that string and output that value. Use the icon for Rosetta Code as the data to c
Continue ReadingCreating a Memory Leak With Java
I just had an interview, and I was asked to create a memory leak with Java. Needless to say I felt pretty dumb having no clue on how to even start cre
Continue ReadingAvoiding “!= Null” Statements in Java?
I work with Java all day long. The most used idiom (code snippet) I’m programming in Java, is to test if an object != null before I use it. This is
Continue Reading




