C ++继续还是打破 [英] c++ continue versus break
本文介绍了C ++继续还是打破的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
哪个语句将在 continue或 break之后执行?
Which statement will be executed after "continue" or "break" ?
for(int i = 0; i < count; ++i)
{
// statement1
for(int j = 0; j < count; ++j)
{
//statement2
if(someTest)
continue;
}
//statement3
}
for(int i = 0; i < count; ++i)
{
// statement1
for(int j = 0; j < count; ++j)
{
//statement2
if(someTest)
break;
}
//statement3
}
推荐答案
继续: ++ j
,然后如果 j<计数
,然后 statement2
,否则 statement3
continue: ++j
and then if j < count
then statement2
otherwise statement3
中断: statement3
这篇关于C ++继续还是打破的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文