break:结束当前循环
continue:结束本次循环执行下一次循环
例如:
#include<stdio.h>
int main()
{
for (int i = 0; i <= 10; i++)
{
if (5 == i)
{
break;
}
printf("%d\n", i);
}
//会输出0 1 2 3 4
for (int i = 0; i <= 10; i++)
{
if (5 == i)
{
continue;
}
printf("%d\n", i);
}
//会输出0 1 2 3 4 6 7 8 9 10
return 0;
}