search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

C++/C# 函數參數 預設值 – jashliao部落格

C++/C# 函數參數 預設值

 

#include

using namespace std;

void do_something(int n = 22)
{
    std::cout << n << std::endl;
}

int main()
{
    cout << “Hello World” << endl; 
    do_something(11);
    do_something();   
    return 0;
}

 

 

///////////////////////////////////////////////////////////

 

using System.IO;//C#
using System;

class Program
{
    static void do_something(int n = 22)
    {
        Console.WriteLine(“n=”+n);
    }
    static void Main()
    {
        Console.WriteLine(“Hello, World!”);
        do_something(11);
        do_something();          
    }
}

 

 

 

 



熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦