I know break statements are pretty basic, but it's got me here:
This is my function:
for (int i = 0; i < voter_count; i++)
{
for (int j = 0; j < candidate_count; j++)
{
if (candidates[preferences[i][j]].eliminated == false)
{
candidates[preferences[i][j]].votes++;
break;
}
}
}
return;
Now, it works perfectly. But if i remove the break; it will not give the correct output! Can someone please clarify what exactly is break; doing here. I mean i have worked with some program mes involving loops, but never experienced this!
Thank You