您现在的位置: 中国男护士网 >> 考试频道 >> 计算机等级 >> 二级辅导 >> C十十 >> 辅导 >> 正文    
  灵活使用GOTO语句 【注册男护士专用博客】          

灵活使用GOTO语句

www.nanhushi.com     佚名   不详 

  看了下面这个例子你肯定会惊叹GOTO语言原来可以这样用啊,呵呵。 
#include <string>
#include <iostream>
using namespace std;
class B{
public:
    B(){
        cout << "BBBBBBBBBBBB" <<endl;
    };
    
    ~B(){
        cout << "SHB" << endl;
    };
protected:
private:
};
int func(...){
    cout << "EN";
    return 0;
};
int main (int argv,char* argc[]){
    char * str_1 = "HelloTEST";
    char str_2[200] ;
    
    func(1,"ABC",false);
    memset(str_2,’F’,200);
    strcpy(str_2,str_1);
    const int ** p;
    int * const *q;
    while(1)
    {
        B b;
        //goto HEIHEI;   屏蔽掉goto 和开启goto 看看 B的析构函数是怎么跑的,能正确析构吗?goto都干了什么。
    }
HEIHEI: int ABC = 0;
        return 0;
}

 

文章录入:杜斌    责任编辑:杜斌 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
     

    联 系 信 息
    QQ:88236621
    电话:15853773350
    E-Mail:malenurse@163.com
    免费发布招聘信息
    做中国最专业男护士门户网站
    最 新 热 门
    最 新 推 荐
    相 关 文 章
    没有相关文章
    专 题 栏 目