for(;;){ /********* infinite iteration**************/
for(k=1;k<=8;k++){
loop1:
for(n=0; n<48;n++){
for(i=0; i<8; i++){
for(j=0; j<natm; j++){
...................
statements;
}
}
}
E[iter] /*** Result of three loops such as n,i,j ***/
if (E[iter] < E[iter-1])
{
iter++;
print the value of E[iter];
/***again calculate the E[iter] ****/
goto loop1;
}
else if(E[iter]>E[iter-1])
{
/** stop the current for loop of k and move to k=2 **/
/*** here is the problem for me i want to get rid of this loop and goto to the next iteration for loop (k =2)***/
}
}
}
最佳答案
替换您的评论/*这就是问题所在...... 与
continue;
Continue 语句将跳过当前迭代并继续进行下一次迭代,而不会像 Break 那样中断整个循环;声明。
关于c - else if 语句错误,我如何转到嵌套 for 循环中的下一个语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15783619/