(1)break

直接调出当前循环体。如果是嵌套循环,他只能调出一层循环体。

Exp-1:

程序:

#include<iostream>

using namespace std;

int main()

{

    for(int i=;i<;i++)

    {

       cout<<"the first circle"<<"  "<<i<<endl;

       for(int j=;j<;j++)

       {

           if(j==)

              break;

           cout<<"the second circle"<<"  "<<j<<endl;

       }

    }

    return ;

}

运行结果:

the first circle  0

the second circle  0

the first circle  1

the second circle  0

the first circle  2

the second circle  0

请按任意键继续. . .

(2) continue

忽略循环体中continue后面的的语句,进入下一次循环开始前的条件判断,不跳出该循环。

Exp-2:

程序:

#include<iostream>

using namespace std;

int main()

{

    for(int i=;i<;i++)

    {

       cout<<"the first circle"<<"  "<<i<<endl;

       for(int j=;j<;j++)

       {

           if(j==)

              continue;

           cout<<"the second circle"<<"  "<<j<<endl;

       }

    }

    return ;

}

运行结果:

the first circle  0

the second circle  0

the second circle  2

the first circle  1

the second circle  0

the second circle  2

the first circle  2

the second circle  0

the second circle  2

请按任意键继续. . .

(3) return

return表示中止当前函数的运行,并将操作权返回给调用者。    
如果是在main函数中,表示将操作权返回给操作系统。

最新文章

  1. 分享10款非常有用的 Ajax 插件
  2. android常犯错误记录
  3. 【Tomcat】tomcat报错 removeGeneratedClassFiles failed
  4. Win10 安装Vs2015 社区版和企业版各个问题汇总
  5. 论文笔记之:Co-saliency Detection via A Self-paced Multiple-instance Learning Framework
  6. c# MessageBox使用
  7. JAVA swing中JPanel如何实现分组框的效果以及设置边框颜色 分类: Java Game 2014-08-16 12:21 198人阅读 评论(0) 收藏
  8. cocos2d-x 读取 json 文件并用 jsoncpp 做解析
  9. SRM 588 D2 L2:GUMIAndSongsDiv2,冷静思考,好的算法简洁明了
  10. python 发送163邮件
  11. 南昌邀请赛I.Max answer 单调栈+线段树
  12. mac新手使用
  13. CocoaPods 简介
  14. [No0000E8]C# 方法 参数传递
  15. 基于tensorflow的MNIST手写识别
  16. thymeleaf 处理模板为字符串
  17. jsp路径问题之base
  18. 4569: [Scoi2016]萌萌哒
  19. “通用类型系统”(CTS)
  20. maven springmvc spring data jpa hibernate sqlserver demo

热门文章

  1. (九)打印机驱动设置—USB接口的设置
  2. Nginx配置http强制跳转到https
  3. JavaScript Boolean(布尔) 对象
  4. JS特殊符号
  5. ejs 基本语法
  6. java问题整理
  7. mysql如何将一个表导出为excel表格
  8. Asp.net 实现图片缩放 无水印(方法二)
  9. sphinx (coreseek)——2、区段查询实例
  10. PuTTY + Xming 远程使用 Linux GUI