網路城邦
上一篇 回創作列表 下一篇   字體:
c++
2022/03/06 18:53:08瀏覽437|回應2|推薦0

#include <iostream>

using namespace std;

#define show_message(xxx) { cout << xxx << endl; }

void myfunc1();

void myfunc2();

void myfunc3();

void myfunc1() {

    show_message("starting myfunc1, then calling myfunc2");

    myfunc2();

    show_message("ending myfunc1 and all_myfuncs end.");

}

void myfunc2() {

    show_message("starting myfunc2, and then call myfunc3");

    myfunc3();

    show_message("ending myfunc2");

}

void myfunc3() {

    show_message("starting myfunc3");

    show_message("ending myfunc3");

}

int main() {

    show_message("starting main");

    myfunc1();

    show_message("ending main and all stop!");

    cout << endl; // print a blank line

   

    return 0;

}

( 知識學習隨堂筆記 )
回應 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=chenliyunn&aid=155348718

 回應文章

大同
等級:8
留言加入好友
2022/03/06 20:36

這只是一個很簡單的程式:由主程式呼叫副程式一(也稱為函數一),一又呼叫二,二又呼叫三;

結束時的順序相反:副程式三返回到二,二則返回到一,一結束則是回到主程式,然後主程式結束當然就代表整個程式全部結束。

大同(chenliyunn) 於 2022-03-08 17:23 回覆:
國外的網頁

大同
等級:8
留言加入好友
2022/03/06 19:26

文章的解說