这是我之前的问题https://codereview.stackexchange.com/questions/12165/efficency-in-c/12169的后续,我尽我所能使用 BigIntegers 代替 ulongs,但我必须做点什么错误的。我是 C# 新手,我熟悉 Java。这是我最好的转换方法:
using System;
namespace System.Numerics{
public class Factorial{
public static void Main(){
String InString = Console.ReadLine();
BigInteger num = 0;
BigInteger factorial = 1;
try {
num = BigInteger.Parse(InString);
Console.WriteLine(num);
}
catch (FormatException) {
Console.WriteLine("Unable to convert the String into a BigInteger");
}
for (BigInteger forBlockvar = num; forBlockvar > 1; forBlockvar--){
factorial *= forBlockvar;
}
Console.WriteLine("The Factorial for the Given input is:");
Console.WriteLine(factorial);
}
}
}
我收到以下错误:
prog.cs(11,18): error CS0246: The type or namespace name `BigInteger' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(13,18): error CS0246: The type or namespace name `BigInteger' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(26,22): error CS0246: The type or namespace name `BigInteger' could not be found. Are you missing a using directive or an assembly reference?
这个错误是什么意思,我该如何解决?