500万彩票网全国开奖:一个简单C#程序中的小错误

来源:百度文库 编辑:神马品牌网 时间:2024/04/27 22:42:09
using System;
class TestCon
{
public TestCon()
{
Console.WriteLine("调用了构造函数");
}
~TestCon()
{
Console.WriteLine("调用了析构函数:");
}
public long fact(long n)
{

if (n==0 & n==1)
return 1;
else return n*fact(n-1);
}
}
class test
{
public static void Main()
{
long d;

TestCon c=new TestCon();
Console.WriteLine("dfasf");
d=c.fact(4);
Console.WriteLine("d is {0}",d);
}
}
不能输出d的值是咋回事呀。

if (n==0 & n==1)
if (n==0 || n==1)

if (n==0 & n==1)
if (n==0 || n==1)

if (n==0 & n==1)
if (n==0 || n==1)