I have an interesting problem:
My program must to find the maximum number of 1.
But that’s not all!.
If the program has “seen” 1, then it should clear the entire column and row in which the 1 is located.
The problem I have:
I can not find the maximum number of 1, I do not know how to do that.
For you I made a small example, I hope it will be clear to you. The program must work like this:
There is a matrix:
1 0 0 0
1 0 1 1
1 1 1 1
1 0 0 1
The program found 1 (position [0][0] I’ve highlighted it in black), and cleared the row and column:

After this we find the next 1, cleared the row and columnand so on:

At the end, the program should print the number of black cells.
In my example it’s 4
How to do it in C++ code? Please help me! Thank you.
I prefer to do it like this (see code below): Use two “for” loops and inside the second use conditional “if” to add the third “for” loop to set to 0.