本帖最後由 鄭繼威 於 2022-5-28 11:52 編輯
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- void welcome4(int i){
- cout<<"這裡是welcome4函式,我接到的參數是:"<<i<<endl;
- }
- void welcome3(){
- cout<<"這裡是welcome3函式,準備再往下呼叫welcome4囉!順便傳參數"<<endl;
-
- int i;
- cout<<"你要傳多少過去?";
- cin>>i;
- cout<<"你要傳"<<i<<",準備再往下呼叫welcome4囉!"<<endl;
- system("pause");
- welcome4(i);
- }
- void welcome2(){
- cout<<"這裡是welcome2函式,準備再往下呼叫welcome3囉!"<<endl;
- system("pause");
- welcome3();
- }
- void welcome1()
- {
- cout<<"這裡是welcome1函式,準備再往下呼叫welcome2囉!"<<endl;
- system("pause");
- welcome2();
- }
- int main()
- {
- cout<<"這裡是main函式,準備進入副程式囉!"<<endl;
- system("pause");
- welcome1();
- return 0;
- }
複製代碼 |