Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/124.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在C++; 我最近开始研究C++编程,并尝试理解如何在C++中实现等价的PHP代码。 我试图找到一种在C++中创建关联数组的方法,并使用嵌套的For循环或循环来循环它。_C++_Loops_Multidimensional Array - Fatal编程技术网

如何在C++; 我最近开始研究C++编程,并尝试理解如何在C++中实现等价的PHP代码。 我试图找到一种在C++中创建关联数组的方法,并使用嵌套的For循环或循环来循环它。

如何在C++; 我最近开始研究C++编程,并尝试理解如何在C++中实现等价的PHP代码。 我试图找到一种在C++中创建关联数组的方法,并使用嵌套的For循环或循环来循环它。,c++,loops,multidimensional-array,C++,Loops,Multidimensional Array,php代码示例如下: $data = array("type1" = > array( "subtype1" = > array("subsubtype1" = > 10,"subsubtype2" = > 20)),"subtype2" = > array("subsubtype1" = > 30,"subsubtype2" = > 40))); foreach($data as $type = > $subtypes) { foreac

php代码示例如下:

$data = array("type1" = > array( "subtype1" = > array("subsubtype1" = > 10,"subsubtype2" = > 20)),"subtype2" = > array("subsubtype1" = > 30,"subsubtype2" = > 40)));
foreach($data as $type = > $subtypes) {
    foreach($subtypes as $subtype = > $subsubtypes) {
        foreach($subsubtypes as $subsubtype = > $value) {
            $result[$type][$subtype] *= $value;
        }
    }
}

到目前为止,我已经发现如何使用循环来循环多维数组,但是我不能找到关于循环关联数组的信息,并将结果存储到C++中的关联数组。


我的问题是,在C++中,是否可以做同样的事情?对于关联数组,如何?

,<代码> STD::unOrdEdjPad < /C>?(或)和(或某些)?在这种特定的情况下,最内层的循环可能是使用。