Does anyone know how to loop through a multidimensional array and print its elements in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Does anyone know how to loop through a multidimensional array and print its elements in C++?

I need an explanation and an example how that can be done.

29th Oct 2017, 2:41 AM
DeltaTick
DeltaTick - avatar
6 Answers
+ 6
A double dimension array in c++ is a collection of variable of same data types . A double dimension array can be explained in lay man language as a table of anything that contains rows and columns . The best example of double dimension array in c++ is a matrix of size r*c where r is the number of rows and c is the number of columns . While you are printing a double dimensional array , you need to use two loops (one for rows and another for column ) .Where there should be a line feed after each row . Ace's code is an example of matrix representation .
29th Oct 2017, 2:58 AM
RZK 022
RZK 022 - avatar
+ 4
Ace, why was the parameter of main: void?
29th Oct 2017, 2:49 AM
DeltaTick
DeltaTick - avatar
+ 3
@Ace, why is the first array empty brackets?
29th Oct 2017, 6:52 PM
DeltaTick
DeltaTick - avatar
+ 3
Also, can you show me how to use if-else statements instead of the switch statement?
29th Oct 2017, 6:53 PM
DeltaTick
DeltaTick - avatar
+ 2
Also Ace, could you give me a different example where the arrays contain the elements 0's and 1's and exchange 0 with "+" and 1 with "-"?
29th Oct 2017, 3:46 AM
DeltaTick
DeltaTick - avatar