I'm trying to use a nested for loop to change the first 'o' it finds while testing to an 's' and then exit the loop immediately after that. This is what I have, but it currently changes every second 'o' to 's'
for (int i = 0; i <8; i++)
for (int j = 1; j<4; j++)
if (tickets[i][j] == 'o')
tickets[i][j++] = 's';
This is where I'm going wrong (I think) but not sure if this is even the right approach for what I'm trying to do.
The function containing the for loop above prints out:
Row 1 o s o s
Row 2 o s o s
Row 3 o s o s
Another function in my code takes input from users to change the chart according to the user's input. So, starting with a "clean" chart where everything has been initialised to 'o', the userinput can make changes and the chart can look like this for example:
Row 1 s s o s
Row 2 s o s s
Row 3 s s o s
So, what I'm trying to do with the for loop is to test for the first 'o', which is in Row 1, third column in this example, and to change this to 's' and then exit the loop without making further changes.