Skip to content

Instantly share code, notes, and snippets.

@hatelove
Created March 21, 2012 10:52
Show Gist options
  • Save hatelove/2146145 to your computer and use it in GitHub Desktop.
Save hatelove/2146145 to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
string[] ten = new string[] { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" };
string[] di = new string[] { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };
Recursive(ten, di, 0, 0);
}
static void Recursive(string[] ten, string[] di, int tenPointer, int diPointer)
{
if (tenPointer == ten.Length && diPointer == di.Length)
{
return;
}
var nextTen = tenPointer % ten.Length;
var nextDi = diPointer % di.Length;
JustDoIt(ten[nextTen], di[nextDi]);
Recursive(ten, di, nextTen + 1, nextDi + 1);
}
static void JustDoIt(string ten, string di)
{
Console.Write("{0}{1}, ", ten, di);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment