Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

repetition

Name: Anonymous 2008-09-29 13:09

print "dongs" five times in your favorite language

with extreme conciseness/verbosity

Name: Anonymous 2008-09-30 16:36

>>68
I think mine is better:

#include <iostream>
#include <string>

template < int N > struct dongs { static const std::string v; };
template < int N > const std::string dongs<N>::v = dongs< N - 1 >::v + "dongs";

template <> struct dongs<0> { static const std::string v; };
const std::string dongs<0>::v = "";

int main() {
        std::cout << dongs<5>::v;
        return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List