Skip to content

Instantly share code, notes, and snippets.

@kureikei
Created March 3, 2015 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kureikei/b4b3cd3f7e10391c787e to your computer and use it in GitHub Desktop.
Save kureikei/b4b3cd3f7e10391c787e to your computer and use it in GitHub Desktop.
#include <complex>
#include <iostream>
#include <locale>
int main()
{
auto const haiku = L"島々に    灯をともしけり春の海       正岡子規";
std::complex<int> c(3, 0), cp(c);
std::complex<int> const r(-1, 0), i(0, 1);
std::ios_base::sync_with_stdio(false);
std::locale::global(std::locale(""));
std::wcout.imbue(std::locale(""));
for (auto a = 0; a < 21; a++, c += r) {
if (!c.real()) {
std::wcout << haiku[7 * c.real() + c.imag()] << std::endl;
cp += i;
c = cp;
}
std::wcout << haiku[7 * c.real() + c.imag()];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment