所以我對C#編程還比較陌生,所以我確信我在這裏犯了一個非常簡單的錯誤。我正在使用Visual Studio製作控制檯應用程序,並且在此應用程序中,我正在嘗試查找數字的平方根。我有.NET框架。
這裏是我的程序的頂部:C#Math.Sqrt()不起作用
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Linear
{
public static class Math
{
static void Main()
{
// program in here
}
}
}
在節目中,我有一條線,是這樣的:
double distanceA = Math.Sqrt(totalA);
所以,當我建立程序與VS,它告訴我, 'Linear.Math'不包含'Sqrt'的定義。 爲什麼這麼說?我如何給它定義'Sqrt'?
** TL; DR **'System.Math.Sqrt(totalA);' – Cyral 2014-11-04 02:40:45