201504 C#初級班-funtion
程式一
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static public int function()
{
return 5;
}
static void Main(string[] args)
{
Console.WriteLine("a:" + function().ToString() );
Console.ReadKey();
}
}
}
程式二
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static public int function(int x)
{
return x;
}
static void Main(string[] args)
{
Console.WriteLine("a:" + function(20).ToString());
Console.ReadKey();
}
}
}
Comments
Post a Comment