Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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 ...
Donald's user avatar
  • 359
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 ...
Joe Z.'s user avatar
  • 35.1k
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 ...
Narfanator's user avatar
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 ...
Bogdan Alexandru's user avatar
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 ...
Bogdan Alexandru's user avatar
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?
Luchian Grigore's user avatar
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: ...
fredoverflow's user avatar
  • 2,709
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, ...
Elazar Leibovich's user avatar
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: ...
user avatar