• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Number类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Number的典型用法代码示例。如果您正苦于以下问题:C# Number类的具体用法?C# Number怎么用?C# Number使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Number类属于命名空间,在下文中一共展示了Number类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            while (true)
            {
                string inputStringA = Console.ReadLine();
                Number inputNum = new Number(inputStringA, false, 0, 0);
          //      string inputStringB = Console.ReadLine();
            //    Number testNum = new Number(inputStringB, false, 0, 0);
                int accuracy = Convert.ToInt32(Console.ReadLine());

            //    Calculation Cal = new Calculation();
              //  Number result = Cal.Multiply(inputNum, testNum, accuracy);

                RangeAssist rangeAssist = new RangeAssist(inputNum, accuracy);

                Taylor taylor = new Taylor(rangeAssist.numConverted, accuracy);
                Number resultTaylor = rangeAssist.NumRecover(taylor.TaylorCalculate());
                resultTaylor.Display();

                Romberg romberg = new Romberg(rangeAssist.numConverted, accuracy);
                Number resultRomberg = rangeAssist.NumRecover(romberg.RombergCalculate());
                resultTaylor.Display();

                Newton newton = new Newton(rangeAssist.numConverted, accuracy);
                Number resultNewton = rangeAssist.NumRecover(newton.NewtonCalculate());
                resultNewton.Display();

               /* Euler Eul = new Euler(inputNum, accuracy);
                Number resultEul = Eul.EulerCalcutation();
                resultEul.Display();*/
            }
        }
开发者ID:lohasbai,项目名称:Arctanx,代码行数:32,代码来源:Program.cs


示例2: MeanAndStandardDeviation

 public MeanAndStandardDeviation(Number mean, Number standardDeviation)
 {
   base.\u002Ector();
   MeanAndStandardDeviation standardDeviation1 = this;
   this.mean = mean;
   this.standardDeviation = standardDeviation;
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:7,代码来源:MeanAndStandardDeviation.cs


示例3: NounWorks

 protected void NounWorks(Noun noun, Dictionary<Case, string> expected, Number number, string nounName)
 {
     foreach (KeyValuePair<Case, string> kvp in expected)
       {
     Assert.AreEqual(kvp.Value, noun.Get(kvp.Key, number), "{0} {1} for {2} doesn't work", kvp.Key, number, nounName);
       }
 }
开发者ID:skewwhiffy,项目名称:LatinTester,代码行数:7,代码来源:NounDeclensionTestBase.cs


示例4: Play

 /// <summary>
 /// Simulates a throw of the ball on the roulette.
 /// </summary>
 /// <returns>The number where the ball landed.</returns>
 public Number Play()
 {
     int v = _Rand.Next(0, 36);
     Number n= new Number(v);
     History.Add(n);
     return n;
 }
开发者ID:SRKX,项目名称:casino-martingale,代码行数:11,代码来源:Roulette.cs


示例5: Source

        /*
         * Construct attatched to a number
         */
        public Source(Number number,        string name,
                  string referring_url, string not_referrer_url,
                  string landing_url,   string not_landing_url,
                  int    position,      bool   online)
        {
            this.token            = number.token;
              this.name             = name;
              this.referring_url    = referring_url;
              this.not_referrer_url = not_referrer_url;
              this.landing_url      = landing_url;
              this.not_landing_url  = not_landing_url;
              this.online           = online;
              this.position         = position;

              if (number.id == ""){
            this.error = "Number has no id";
            return;
              }

              string url = CTM.Config.Endpoint() + "/accounts/" + token.account_id + "/numbers/" + number.id + "/tracking_sources.json";

              CTM.Response res = new CTM.Request(url, token).post(this.params_hash());

              if (res.error != null){
            this.error = res.error;
              }else{
            this.update_from(res.data.source);
              }
        }
开发者ID:calltracking,项目名称:ctm-csharp,代码行数:32,代码来源:source.cs


示例6: TestBasicComparison

        public void TestBasicComparison()
        {
            Number n1 = new Number(6, new List<char>() { 'i', 'g' }); //12
            Number n2 = new Number(6, new List<char>() { 'i', 's' }); //13
            Assert.AreEqual(Order.LESSER, numberSystem.Compare(n1, n2));

             n1 = new Number(6, new List<char>() { 'i', 's' }); //12
             n2 = new Number(6, new List<char>() { 'i', 'g' }); //13
            Assert.AreEqual(Order.GREATER, numberSystem.Compare(n1, n2));

            n1 = new Number(6, new List<char>() { 'i', 'g' }); //12
            n2 = new Number(6, new List<char>() { 'i', 'g' }); //13
            Assert.AreEqual(Order.EQUAL, numberSystem.Compare(n1, n2));

            n1 = new Number(6, new List<char>() { 'i', 'g', 's' }); //123
            n2 = new Number(6, new List<char>() { 'g', 'g' }); //22
            Assert.AreEqual(Order.GREATER, numberSystem.Compare(n1, n2));

            n1 = new Number(6, new List<char>() { 'i', 'o' }); //14 => 10 in base10
            n2 = new Number(10, new List<char>() { 'i', 'b' }); //10 in decimal 10
            Assert.AreEqual(Order.EQUAL, numberSystem.Compare(n1, n2));

            n1 = new Number(6, new List<char>() { 'g', 'i' }); //20 => 12 in base10
            n2 = new Number(10, new List<char>() { 'i', 'b' }); //10 in decimal 10
            Assert.AreEqual(Order.GREATER, numberSystem.Compare(n1, n2));

            n1 = new Number(2, new List<char>() { 'i', 'b', 'b', 'b' }); //1000 in base2 => 8 in base10
            n2 = new Number(10, new List<char>() { 'i', 'b' }); //10 in decimal 10
            Assert.AreEqual(Order.LESSER, numberSystem.Compare(n1, n2));
        }
开发者ID:02ps719,项目名称:DSA,代码行数:30,代码来源:ComparisonTest.cs


示例7: fillValues

        public Number[] fillValues(Number[] source)
        {
            List<double> Bx = new List<double>();
            List<double> By = new List<double>();
            List<double> Bz = new List<double>();
            List<double> x = new List<double>();
            int n;

            for (int i = 0; i < source.Length; i++)
            {
                if (source[i] != null)
                {
                    x.Add(i);
                    Bx.Add(source[i].x);
                    By.Add(source[i].y);
                    Bz.Add(source[i].z);
                }
            }

            n = x.Count();

            SplineTuple[] splinesX = BuildSpline(x.ToArray(), Bx.ToArray(), n);
            SplineTuple[] splinesY = BuildSpline(x.ToArray(), By.ToArray(), n);
            SplineTuple[] splinesZ = BuildSpline(x.ToArray(), Bz.ToArray(), n);

            for (int i = 0; i < source.Length; i++)
            {
                if (source[i] == null)
                {
                    source[i] = new Number(Interpolate(i, splinesX), Interpolate(i, splinesY), Interpolate(i, splinesZ));
                }
            }

            return source;
        }
开发者ID:programmerr47,项目名称:diplomaV2_0,代码行数:35,代码来源:CubicSpline.cs


示例8: Clock

 /// <summary>
 /// constructor for a Clock object
 /// </summary>
 public Clock()
 {
     minutes = new Number(60);
     seconds = new Number(60);
     thousandths = new ThreeDigitNumber(1000);
     UpdateDisplay();
 }
开发者ID:jhpaterson,项目名称:LahtiOOP,代码行数:10,代码来源:Clock.cs


示例9: When_CompareNumbers_Then_Success

        public void When_CompareNumbers_Then_Success()
        {
            var mainNumber = new Number(6, 8, 0, 1);
            var numberToCompare1 = new Number(1, 8, 9, 4);
            var numberToCompare2 = new Number(6, 8, 0, 1);
            var numberToCompare3 = new Number(1, 0, 6, 2);
            var numberComparer = new NumberComparer();

            var attemptResult1 = numberComparer.Compare(mainNumber, numberToCompare1);
            var attemptResult2 = numberComparer.Compare(mainNumber, numberToCompare2);
            var attemptResult3 = numberComparer.Compare(mainNumber, numberToCompare3);

            Assert.AreEqual(numberToCompare1, attemptResult1.Number);
            Assert.AreEqual(1, attemptResult1.Goods);
            Assert.AreEqual(1, attemptResult1.Regulars);
            Assert.AreEqual(2, attemptResult1.Bads);

            Assert.AreEqual(numberToCompare2, attemptResult2.Number);
            Assert.AreEqual(4, attemptResult2.Goods);
            Assert.AreEqual(0, attemptResult2.Regulars);
            Assert.AreEqual(0, attemptResult2.Bads);

            Assert.AreEqual(numberToCompare3, attemptResult3.Number);
            Assert.AreEqual(0, attemptResult3.Goods);
            Assert.AreEqual(3, attemptResult3.Regulars);
            Assert.AreEqual(1, attemptResult3.Bads);
        }
开发者ID:ThinkUpStudios,项目名称:GuessMyNumber,代码行数:27,代码来源:NumberComparerTests.cs


示例10: DerivativeTest3

        public void DerivativeTest3()
        {
            // x ^ 3
            Variable x = new Variable("x");
            Number num1 = new Number(3);

            IExpression exp = new Pow(x, num1);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("1 * (3 * (x ^ (3 - 1)))", deriv.ToString());

            num1.Value = 4;
            Assert.AreEqual("x ^ 4", exp.ToString());
            Assert.AreEqual("1 * (3 * (x ^ (3 - 1)))", deriv.ToString());

            // 2 ^ (3x)
            Number num2 = new Number(2);
            num1 = new Number(3);
            Mul mul = new Mul(num1, x.Clone());

            exp = new Pow(num2, mul);
            deriv = exp.Differentiate();

            Assert.AreEqual("(ln(2) * (2 ^ (3 * x))) * (3 * 1)", deriv.ToString());

            num1.Value = 4;
            Assert.AreEqual("2 ^ (4 * x)", exp.ToString());
            Assert.AreEqual("(ln(2) * (2 ^ (3 * x))) * (3 * 1)", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:29,代码来源:ExponentiationTest.cs


示例11: SLColor

 public SLColor( double Red, double Green, double Blue )
     : this()
 {
     red = new Number( Red );
     green = new Number( Green );
     blue = new Number( Blue );
 }
开发者ID:LukaHorvat,项目名称:Kento,代码行数:7,代码来源:SLColor.cs


示例12: AdjectiveForm

 internal AdjectiveForm(Stem stem, Gender gender, Case @case, Number number, string suffix)
     : base(stem, suffix)
 {
     Gender = gender;
     Case = @case;
     Number = number;
 }
开发者ID:IxMilia,项目名称:Classics,代码行数:7,代码来源:AdjectiveForm.cs


示例13: Main

    public static int Main(string[] args)
    {
        if (args.Length < 5) {
            System.Console.WriteLine("Usage: <number> <base> <charset> <newBase> <newCharset>");
            return 1;
        }

        if (args[1] == "-") {
            args[1] = "10";
        }

        if (args[2] == "-") {
            args[2] = Number.DefaultCharset();
        }

        if (args[4] == "-") {
            args[4] = Number.DefaultCharset();
        }

        try {
            Number number = new Number(args[0], System.Convert.ToInt32(args[1]), args[2]);
            System.Console.WriteLine(number.ToBase(System.Convert.ToInt32(args[3]), args[4]));
        }
        catch (System.Exception e) {
            System.Console.WriteLine("Error: " + e.Message);

            return 2;
        }

        return 0;
    }
开发者ID:rlishtaba,项目名称:random,代码行数:31,代码来源:baseconverter.cs


示例14: MainWindow

 public MainWindow()
 {
   InitializeComponent();
   if (Directory.Exists(systemDir))
     Directory.Delete(systemDir, true); // remove systemDir from prior runs and all its databases.
   try
   {
     session = new SessionBase[4];
     thread = new Thread[4];
     session[0] = new SessionNoServer(systemDir, int.Parse(session1LockTimeout.Text));
     session[1] = new SessionNoServer(systemDir, int.Parse(session2LockTimeout.Text));
     session[2] = new SessionNoServer(systemDir, int.Parse(session3LockTimeout.Text));
     session[3] = new SessionNoServer(systemDir, int.Parse(session4LockTimeout.Text));
     session[0].BeginUpdate();
     Placement place = new Placement(10);
     Number number = new Number();
     session[0].Persist(place, number);
     number = new Number(2);
     place = new Placement(11);
     session[0].Persist(place, number);
     number = new Number(3);
     place = new Placement(12);
     session[0].Persist(place, number);
     session[0].Commit();
   }
   catch (Exception ex)
   {
     session1messages.Content = ex.Message;
   }
 }
开发者ID:VelocityDB,项目名称:VelocityDB,代码行数:30,代码来源:DatabaseLocking.xaml.cs


示例15: HslColor

 public HslColor(Number hue, Number saturation, Number lightness, Number alpha)
 {
   Hue = (hue.ToNumber()/360d)%1d;
   Saturation = saturation.Normalize(100d)/100d;
   Lightness = lightness.Normalize(100d)/100d;
   Alpha = alpha.Normalize();
 }
开发者ID:jamesfoster,项目名称:dotless.js,代码行数:7,代码来源:HslColor.cs


示例16: DeclareVariable

        /// <summary>
        /// Declares a variable if there is a declaration and deletes unnessesary stuff
        /// </summary>
        /// <param name="listE"> stream of tokens </param>
        /// <returns> true if we need to launch the function again </returns>
        public static bool DeclareVariable(List<Element> listE)
        {
            if (listE.Count > 2) // it can be a declaration only if the list has more than 2 elements
            {
                if (listE[0].Type == C.Number && listE[1].Type == C.Control) // if it is a number
                {
                    string name = listE[0].GetNumber().Name;
                    if (name != "" && listE[1].ToString() == "=") // if it is a variable
                    {
                        listE.RemoveRange(0, 2);
                        Number num = new Number(Parse(listE).Value.ToString());
                        num.Name = name;
                        Variable.Add(num);

                        return false;
                    }
                }
            }

            int index = listE.FindIndex(delegate(Element e)
                                        { if (e.ToString() == "=") return true; return false; });
            if (index != -1) { listE.RemoveRange(0, index + 1); return true; }

            return false;
        }
开发者ID:jakl,项目名称:hashite,代码行数:30,代码来源:Parser.cs


示例17: EditHsl

        protected override Node EditHsl(HslColor color, Number number)
        {
            WarnNotSupportedByLessJS("hue(color, number)");

            color.Hue += number.Value/360d;
            return color.ToRgbColor();
        }
开发者ID:Ralphvanderneut,项目名称:dotless,代码行数:7,代码来源:HueFunction.cs


示例18: BinaryOperation

        internal override bool BinaryOperation(BinaryOperationBinder binder, Any arg, out Any result)
        {
            var number = arg as Number;
            if (number != null)
            {
                switch (binder.Operation)
                {
                    case ExpressionType.Add:
                        result = new Number(Value + number.Value);
                        break;
                    case ExpressionType.Subtract:
                        result = new Number(Value - number.Value);
                        break;
                    case ExpressionType.Multiply:
                        result = new Number(Value * number.Value);
                        break;
                    case ExpressionType.Divide:
                        result = new Number(Value / number.Value);
                        break;
                    case ExpressionType.LessThan:
                        result = Value < number.Value ? Bool.True : Bool.False;
                        break;
                    case ExpressionType.LessThanOrEqual:
                        result = Value <= number.Value ? Bool.True : Bool.False;
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }

                return true;
            }

            return base.BinaryOperation(binder, arg, out result);
        }
开发者ID:gavin-zyi,项目名称:Rin,代码行数:34,代码来源:Number.cs


示例19: Read

        public IList<Number> Read()
        {
            int counter = 1;
            string line;
            IList<Number> numbers = new List<Number>();
            try
            {
                EnsureFile(_fileInfo);
                var file = new System.IO.StreamReader(_filePath);
                while ((line = file.ReadLine()) != null)
                {
                    int value = int.TryParse(line.Trim(), out value) ? value : 0;
                    var number = new Number(counter, value);
                    numbers.Add(number);
                    counter++;
                }

                file.Close();
            }
            catch (Exception exception)
            {

            }

            return numbers;
        }
开发者ID:vaishalipatil,项目名称:VaishaliNumberManager,代码行数:26,代码来源:FileOperations.cs


示例20: Main

        static void Main(string[] args)
        {
            int numberIndex = 1;
            int maxNumberLimit = 100;
            int[] evenNumbers = new int[maxNumberLimit/2];
            int evenNumbersIndex = 0;
            Number number = new Number();
            int tempINdex = numberIndex;
            for(numberIndex=1;numberIndex<=maxNumberLimit;numberIndex++)
            {
                //Number number = new Number(numberIndex);
                number.Value = numberIndex;
                if(number.IsEven())
                {
                    evenNumbers[evenNumbersIndex] = numberIndex;
                    evenNumbersIndex++;

                }

            }

            Console.WriteLine("Even nubers from {0} to {1} are", tempINdex, maxNumberLimit);
            for(int index=0;index<evenNumbers.Length;index++)
            {
                Console.WriteLine(evenNumbers[index]);
            }
        }
开发者ID:QualityThoughtTechnologies,项目名称:DotnetBatch1,代码行数:27,代码来源:Program.cs



注:本文中的Number类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NumberBuffer类代码示例发布时间:2022-05-24
下一篇:
C# Nullable类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap