认识认识break and continue。。。回顾大一
《1》先来break——1看图,看代码,你懂的
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 # include<iostream> 2 # include<cstdio> 3 using namespace std; 4 int main() 5 { 6 for(int i = 0; i < 100; i++) 7 { 8 printf("%d\n",i); 9 if(i == 10) 10 { 11 break; 12 //continue; 13 } 14 15 } 16 printf("hello world\n"); 17 return 0; 18 }
《2》再来看break——2看图,看代码
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 # include<iostream> 2 # include<cstdio> 3 using namespace std; 4 int main() 5 { 6 for(int i = 0; i < 100; i++) 7 { 8 9 if(i == 10) 10 { 11 break; 12 //continue; 13 } 14 printf("%d\n",i); 15 16 } 17 printf("hello world\n"); 18 return 0; 19 }
《3》再来看continue。。看图,看代码
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 # include<iostream> 2 # include<cstdio> 3 using namespace std; 4 int main() 5 { 6 for(int i = 0; i < 100; i++) 7 { 8 9 if(i == 10) 10 { 11 //break; 12 continue; 13 } 14 printf("%d\n",i); 15 16 } 17 printf("hello world\n"); 18 return 0; 19 }
纪念我失去的青春和女友。。。我爱你们。。。