All Questions
Tagged with c++ code-challenge
9 questions
139
votes
23
answers
137k
views
Generate the longest error message in C++
Write a short program, that would generate the longest possible error message, in a standard C++ compiler (gcc, cl.exe, ...
17
votes
8
answers
11k
views
Compute the CRC32 table at compile-time [closed]
The reference implementation of CRC32 computes a lookup table at runtime:
...
13
votes
7
answers
2k
views
Generate ladder of integers using the least number of unique characters (in C++)
I am new to the sport of code golf. I am trying to generate a ladder of integers using the least number of unique characters in C++.
Let's say we are given an integer 4.
We will generate the ...
13
votes
4
answers
1k
views
fizz buzz in TMP [closed]
The Fizz Buzz problem is a very basic problem to solve that is used by some to weed out interviewees that don't know how to program. The problem is:
...
11
votes
5
answers
3k
views
m3ph1st0s's programming puzzle 3 (C): “Easy bug” [closed]
This is the 3rd of my series of C/C++ puzzles; in case you missed the first 2 they are here:
(1) m3ph1st0s's programming puzzle 1 (C++)
(2) m3ph1st0s's programming puzzle 2 (C++): "Call ...
8
votes
6
answers
2k
views
Shortest undefined behavior sample in C++ [closed]
What's the shortest, well-formed C++ code that exhibits undefined behavior?
5
votes
6
answers
2k
views
Make FizzBuzz using only preprocessor directives
I have a source file here:
#include <FizzBuzz.h>
fizzbuzz
And I want to make "fizzbuzz" turn into a FizzBuzz program ...
2
votes
3
answers
853
views
m3ph1st0s's programming puzzle 4 (C/C++): “3-way swap” [closed]
My last puzzle has generated some confusion and controversy so I decided to give up, for now, on those "replace one character"-type puzzles.
Hope this 4th puzzle will redeem myself after all the ...
2
votes
1
answer
561
views
Generate numerical permutations with conditions and template metaprogramming [closed]
This, but via template metaprogramming:
template <int n> struct insanity { int[][n] permutations; }
Generate all numbers with n digits (0-9) such that each ...