Skip to content

Instantly share code, notes, and snippets.

@kureikei
Created Mar 3, 2015
Embed
What would you like to do?
#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