'Is there any way of changing individual elements in a 2D array, with multiple iterations of a for loop in C++
i.e. for the second iteration of a loop, I want to change a specific element to something else....
I am still new to C++ and Stack Overflow your help us greatly appreciated
std:: string ecoClass[5][14]
{
{"|A1", "|A2|", "A3|", "----", "|A4", "|A5", "|A6|"},
{"|F1", "|F2|", "F3|", "----", "|F4", "|F5", "|F6|"},
{"|G1", "|G2|", "G3|", "----", "|G4", "|G5", "|G6|"},
{"|H1", "|H2|", "H3|", "----", "|H4", "|H5", "|H6|"},
{"|I1", "|I2|",}
};
let me try to clarify a bit. If I put this array in a for loop. I want to change elements based on what number my for loop counter is on
for(int i=0;i<5;i++)…based on that for loop is there any way to change elements in my code, e.g. if i=2, I would like ecoClass[0][0]="|**";
and when i=3;
ecoClass[1][2]="|**"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
