我想知道在C++中是否可以在满足其他条件时结束for循环,而不是到达规定的迭代次数。例如:
for (int i = 0; i < maxi; ++i)
for (int j = 0; j < maxj; ++j)
// But if i == 4 < maxi AND j == 3 < maxj,
// then jump out of the two nested loops.
我知道在Perl中可以通过使用next LABEL或last LABEL调用和带标签的块来实现此功能,那么在C++中是否可以实现呢?还是我应该使用while循环?谢谢。