using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace @enum
{
class Program
{
static void swap(int x, int y)
{
int temp;
temp = x;
x = y;
y = temp;
}
static void Main(string[] args)
{
int a = 10;
int b = 20;
Console.WriteLine("交换前,a={0},b={1}" , a, b);
swap(a,b);
Console.WriteLine("a={0},b={1}",a, b);
}
}
}
这上面的"a={0},b={1}" 能不写吗?为什么一定要写?求老师解答 谢谢!!!!
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace @enum
{
class Program
{
static void swap(int x, int y)
{
int temp;
temp = x;
x = y;
y = temp;
}
static void Main(string[] args)
{
int a = 10;
int b = 20;
Console.WriteLine("交换前,a={0},b={1}" , a, b);
swap(a,b);
Console.WriteLine("a={0},b={1}",a, b);
}
}
}
这上面的"a={0},b={1}" 能不写吗?为什么一定要写?求老师解答 谢谢!!!!
http://msdn.microsoft.com/zh-cn/library/system.console.writeline%28VS.80%29.aspx方法的参数含义
我不是这个意思,但是我不写"a={0},b={1}"这个 结果就出不来,在as3.0中是直接可以出来的。
这样肯定不对啊,Console.WriteLine()这个方法没有一下输出2个参数的,改成Console.WriteLine(a+b);这样,将2个字符串合成一个就Ok了。
PS:类里面定义的方法也不能交换a.b的值啊