gpt4 book ai didi

java - 这行得通吗?我正在尝试制作一个多维数组,我很确定它可以在 Java 中运行,但我不知道 C++

转载 作者:太空宇宙 更新时间:2023-11-04 12:12:04 25 4
gpt4 key购买 nike

string months[3][12];
months[0][12] = {"January", "February", "March", "April",
"May", "June", "July", "August", "September", "October",
"November", "December"};
months[1][12] = {"january", "february", "march", "april",
"may", "june", "july", "august", "september", "october",
"november", "december"};
months[2][12] = {"1", "2", "3", "4", "5", "6", "7", "8",
"9", "10", "11", "12"};

如果它不起作用,我怎样才能让它起作用,或者我怎样才能让它更好地起作用?

最佳答案

您不能单独分配内部数组,但您可以在定义数组时这样做:

string months[3][12] = {
{"January", "February", "March", "April",
"May", "June", "July", "August", "September", "October",
"November", "December"},
{"january", "february", "march", "april",
"may", "june", "july", "august", "september", "october",
"november", "december"},
{"1", "2", "3", "4", "5", "6", "7", "8",
"9", "10", "11", "12"}
};

关于java - 这行得通吗?我正在尝试制作一个多维数组,我很确定它可以在 Java 中运行,但我不知道 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9356059/

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