Created
March 9, 2015 12:48
-
-
Save dc1394/d3709bbaf58beef502c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <complex> | |
#include <iostream> | |
#include <locale> | |
#include <string> | |
int main() | |
{ | |
std::wstring 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