[Solved] nested for loops now not working


To answer your second part of the question, with the assumption that every round the health will decrease till 1 player hits 0. (Because the way you are implementing it now, is that every time the inner For-loop is done, you reset the health of both wizard and sorceress, therefore making this requirement useless)

Declare the wizardHealth & sorceressHealth outside both loop

int wizardHP = 30;
int sorceressHP = 30;
for ( int round = 1; round <= 30; round++ ) {
//Do your code execution
     for(int x = 0; x <= ARRAYROW; x++) {
         //Execute fight sequence
         wizardHP -= sorDeck[x].sAttk;  //To store the new hp of wizard
         sorceressHP -= wizDeck[x].wAttk;  //To store the new hp of sorceress
     }
}

This way, every iteration will be using the updated variables and not from 30. (Correct me if i’m wrong about your execution requirements)

P.S Your outer (round) loop is executing perfectly on my IDE. I don’t see a problem.

2

solved nested for loops now not working