예제 #1
0
파일: app.cs 프로젝트: romanlum/StudyCode
    public static void Main(string[] args)
    {
        AdvCalc calc = new AdvCalc();

        Random rnd = new Random();

        for (int i = 0; i < 1000; i++)
        {
            calc.Add(rnd.NextDouble());
        }
        Console.WriteLine("Sum: {0}", calc.GetSum());
        Console.WriteLine("Average: {0}", calc.GetAverage());
    }
예제 #2
0
    public static void Main(string[] args)
    {
        AdvCalc calc = new AdvCalc();

        Random r = new Random();
        for(int i = 0; i < 1000; i++)
        {
            calc.Add(r.NextDouble());
        }

        Console.WriteLine("Sum:     {0}", calc.GetSum());
        Console.WriteLine("Average: {0}", calc.GetAverage());
    }
예제 #3
0
    static void Main(string [] args)
    {
        AdvCalc calc = new AdvCalc();

        Random r = new Random();

        for (int i = 0; i < 1000; i++)
        {
            calc.Add(r.NextDouble());
        }

        Console.WriteLine($"sum: {calc.GetSum():F2}");       //neue Variante direkt in den Platzhalter den Code
        Console.WriteLine("avg: {0:F2}", calc.GetAverage()); //ältere Variante :F2 floating point number 2 NK
    }