2009-03-10から1日間の記事一覧

まだ考えてました。

C++

#include <tuple> #include <iostream> #include <string> #include <functional> #include <stdexcept> void printf(const char *s) { while (*s) { if (*s == '%' && *(++s) != '%') throw std::runtime_error("invalid format string: missing arguments"); std::cout << *s++; } } template</stdexcept></functional></string></iostream></tuple>