法①:算术运算static void Main(string[] args) { int a = 5; int b = 6; a = b - a; b = b - a; a = b + a; Console.WriteLine("a:{0},b:{1}",a,b); Console.Read(); }法②:位运算
static void Main(string[] args) { int a = 10, b = 12; a = a ^ b; b = a ^ b; a = a ^ b; Console.WriteLine("a:{0},b:{1}",a,b); Console.Read(); }
新闻热点
疑难解答