#Output problem idk why its giving me weird output

10 messages · Page 1 of 1 (latest)

cerulean valve
#

after correcting some brackets and semicolons . Still i cant figure out the problem thank you

#

`#include<iostream>
#include<string>
int main(){
std::string z[3][2][2]={
{{"a","b"},{"c","d"}},
{{"e","f"},{"g","h"}},
{{"i","h"},{"j","k"}},
};

for(int i=0;i<3;i++){
    for(int j=0;j<2;j++){
        for(int k=0;k<2;k++){
            std::cout << z[3][2][2] <<" ";
        }

    }
}
std::cout << std::endl;
return 0;

}
`

nocturne belfry
nocturne belfry
cerulean valve
#

print those Multidimensional Arrays with loops

nocturne belfry
nocturne belfry
# cerulean valve didn't understand

Look in the innermost loop
std::cout << z[3][2][2] <<" ";

The array is being indexed by constant values (3, 2 and 2)
This means every time the loop is iterated, the array is indexed by the same values

#

You've defined the variables i, j and k