int[,] vList = {
{ 1, 1, 1 },
{ 2, 2, 2 },
{ 3, 3, 3 },
};
int[] vIndexs = new int[vList.GetLength(1)];for (int k = 0; k < vList.GetLength(1); k++)
vIndexs[k] = 0;bool vBreak = false;
do
{
for (int j = 0; j < vList.GetLength(1); j++)
textBox1.AppendText(vList[vIndexs[j], j].ToString());
textBox1.AppendText("\r\n");
vBreak = true;
for (int j = 0; j < vList.GetLength(1); j++)
if (vIndexs[j] + 1 < vList.GetLength(0))
{
vIndexs[j]++;
for (int i = 0; i < j; i++) vIndexs[i] = 0;
vBreak = false;
break;
}
}
while (!vBreak);
{ 1, 1, 1 },
{ 2, 2, 2 },
{ 3, 3, 3 },
};
int[] vIndexs = new int[vList.GetLength(1)];for (int k = 0; k < vList.GetLength(1); k++)
vIndexs[k] = 0;bool vBreak = false;
do
{
for (int j = 0; j < vList.GetLength(1); j++)
textBox1.AppendText(vList[vIndexs[j], j].ToString());
textBox1.AppendText("\r\n");
vBreak = true;
for (int j = 0; j < vList.GetLength(1); j++)
if (vIndexs[j] + 1 < vList.GetLength(0))
{
vIndexs[j]++;
for (int i = 0; i < j; i++) vIndexs[i] = 0;
vBreak = false;
break;
}
}
while (!vBreak);
解决方案 »
- TypeInitializationException,类的初始值设定发生异常
- 如何将C# 的DATASET 直接写入(Insert)Oracle?
- 听说c#4.0已经出来了?又有些什么新鲜玩意?大家来列列
- C#如何获取文件编码类型,如果哪位高人解决,可以再开贴给分!
- C#中byte型数组如何转换成所需结构体
- 问各位老鸟一个问题:如何快速阅读技术类书籍,如《C#高级编程》
- 请教个反射的问题
- dataGridView行数问题
- C# 浏览器 关闭 放大功能
- 本人需要做一个(税法查询)软件系统,谁要接活,大概和我给你的这个软件类似,请给我一个报价
- 急!!如何将html页面读取到一个.aspx页面中.
- trigger 可以对一张表进行插入时同时修改另一张 怎么做?
using System;namespace Test
{
class Program
{
static void Link(int[,] vList, int result, int n)
{
n--;
foreach (int i in vList)
{
int current = result * 10 + i;
if (n == 0)
Console.WriteLine(current);
else
Link(vList, current, n);
}
}
static void Main(string[] args)
{
int[,] vList = { { 1, 1, 1 }, { 2, 2, 2 }, { 3, 3, 3 } };
int n = 3;
Link(vList, 0, n);
}
}
}
int[,] vList = {
{ 1, 1, 1 },
{ 2, 2, 2 },
{ 3, 3, 3 },
{ 4, 4, 4 },
{ 3, 3, 3 },
//.....这里不用我写完吧,如果有规律可以用代码赋初值
{ 26, 26, 26 },
{ 27, 27, 27 },
};