標題:
函式的建立與執行 (三)
[打印本頁]
作者:
鄭繼威
時間:
2023-4-28 20:11
標題:
函式的建立與執行 (三)
#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;
}
複製代碼
作者:
宜儒
時間:
2023-4-29 15:18
#include<iostream>
#include<cstdlib>
using namespace std;
void welcome4(int i){
cout<<"這裡是welcome4函式,我接到的參數是:"<<i<<endl;
}
void welcome3(){
cout<<"這裡是welcome3函式,準備進入welcome4函式囉!"<<endl;
cout<<"順便回傳參數!"<<endl;
int a;
cout<<"你要回傳的參數是:";
cin>>a;
system("pause");
welcome4(a);
}
void welcome2(){
cout<<"這裡是welcome2函式,準備進入welcome3函式囉!"<<endl;
system("pause");
welcome3();
}
void welcome1(){
cout<<"這裡是welcome1函式,準備進入welcome2函式囉!"<<endl;
system("pause");
welcome2();
}
int main(){
cout<<"這裡是主函式,準備進入welcome1函式囉!"<<endl;
system("pause");
welcome1();
return 0;
}
複製代碼
作者:
陳宥霖
時間:
2023-4-29 15:25
#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;
}
複製代碼
作者:
翁川祐
時間:
2023-4-29 15:28
#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;
}
複製代碼
作者:
林雋喆
時間:
2023-4-29 15:28
#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;
}
複製代碼
作者:
陳牧謙
時間:
2023-4-29 15:28
#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;
}
複製代碼
作者:
吳俊頡
時間:
2023-4-29 15:29
#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;
}
複製代碼
作者:
徐啟祐
時間:
2023-5-4 19:50
#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;
}
複製代碼
作者:
楊芊琦
時間:
2023-5-20 17:52
#include<iostream>
#include<cstdlib>
using namespace std;
void round4(int x)
{
cout << "這裡是round4(),我收到:" << x << endl;
system("pause");
}
void round3()
{
int num;
cout << "這裡是round3(),即將進入round4()" << endl;
cout<<"請傳一個整數:";
cin >> num;
cout << "點擊任意鍵進入round4()" << endl;
system("pause");
round4(num);
}
void round2()
{
cout << "這裡是round2(),即將進入round3()" << endl;
system("pause");
round3();
}
void round1()
{
cout << "這裡是round1(),即將進入round2()" << endl;
system("pause");
round2();
}
int main()
{
cout << "這裡是main(),準備進入副程式" << endl;
system("pause");
round1();
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2