码迷,mamicode.com
首页 > 编程语言 > 详细

c++ goto的使用

时间:2014-09-19 11:53:45      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   使用   2014   div   

c++ goto 语句的使用

1.定义一个类似标签的东西lable

2.使用goto关键字,跳转到lable, goto lable

 1 #include <iostream>
 2 #include <string>
 3 #include <stdlib.h>
 4 #include <stdio.h>
 5 
 6 
 7 #include "header3.h"
 8 
 9 using namespace std;
10 void swap(int&, int&);
11 //void swap(int, int);
12 
13 int main(){
14     bool flag = true;
15     
16 lable:
17     cout<<"hello world!"<<endl;
18 
19     if(flag){
20         flag = !flag;
21         goto lable;
22     }
23     
24 
25     return 0;
26 }

bubuko.com,布布扣

c++ goto的使用

标签:style   blog   http   color   io   os   使用   2014   div   

原文地址:http://www.cnblogs.com/luckygxf/p/3980956.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!