gpt4 book ai didi

c# - double 数组

转载 作者:太空宇宙 更新时间:2023-11-03 11:32:22 24 4
gpt4 key购买 nike

如何修复此代码以使用从 1.015.0 的 double 值填充数组 x?

int temp = 15;

string[] titles = new string[] { "Alpha", "Beta", "Gamma", "Delta" };
List<double[]> x = new List<double[]>();
for (int i = 0; i < titles.Length; i++)
{
for (int j = 0; j < temp; j++)
{
x.Add[i][j]((double) j);
}
}

最佳答案

如果我上面的问题的答案是"is",那么这里是一个答案:

        int temp = 15;

string[] titles = new string[] { "Alpha", "Beta", "Gamma", "Delta" };
List<double[]> x = new List<double[]>();
for (int i = 0; i < titles.Length; i++)
{
double[] test = new double[15];
for (int j = 1; j <= temp; j++)
{
test[j-1] = j;
}
x.Add(test);
}

关于c# - double 数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7349345/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com