[Solved] How do I fix this issue where my 2D array won’t output it’s values in C++? [closed]


The loop

for(int i=0; i<5,i++;)

is wrong. The condition i<5,i++ means i++ because the left operand of the comma operator i<5 doesn’t have side effect and simply ignored. i++ is evaluated to the value before the increment. In this case the value is 0, so it is considered as false and the loop body won’t executed.

The loop should be:

for(int i=0; i<5; i++)

Also you should add

#include <string>

at the top of your code to use the string type and add

}

at the end of your code to finish the definition of the function body.

0

solved How do I fix this issue where my 2D array won’t output it’s values in C++? [closed]