public static void Main(string[] args)
    {
        Console.WriteLine("Function Client");

        if (args.Length == 0)
        {
            Console.WriteLine("Usage: FunctionTest ... ");
            return;
        }

        for (int i = 0; i < args.Length; i++)
        {
            int num = Int32.Parse(args[i]);
            Console.WriteLine(
                "The Digit Count for String [{0}] is [{1}]",
                args[i],
                // Вызов статического метода NumberOfDigits
                // класса DigitCount:
                DigitCount.NumberOfDigits(args[i]));
            Console.WriteLine(
                "The Factorial for [{0}] is [{1}]",
                num,
                // Вызов статического метода Calc класса Factorial:
                Factorial.Calc(num));
        }
    }
Beispiel #2
0
    public static void Main(string[] args)
    {
        Console.WriteLine("Function Client");

        if (args.Length == 0)
        {
            Console.WriteLine("Usage: FunctionTest ... ");
            return;
        }

        for (int i = 0; i < args.Length; i++)
        {
            int num = Int32.Parse(args[i]);
            Console.WriteLine(
                "The Digit Count for String [{0}] is [{1}]",
                args[i],
                // Invoke the NumberOfDigits static method in the
                // DigitCount class:
                DigitCount.NumberOfDigits(args[i]));
            Console.WriteLine(
                "The Factorial for [{0}] is [{1}]",
                num,
                // Invoke the Calc static method in the Factorial class:
                Factorial.Calc(num));
        }
    }
    public static void Show()
    {
        string[] args = new string[] { "3", "5" };

        Console.WriteLine("Function Client");

        if (args.Length == 0)
        {
            Console.WriteLine("Usage: FunctionTest ... ");
            return;
        }

        for (int i = 0; i < args.Length; i++)
        {
            int num = Int32.Parse(args[i]);
            Console.WriteLine(
                "The Digit Count for String [{0}] is [{1}]",
                args[i],
                // 调用 DigitCount 类中的
                // NumberOfDigits 静态方法:
                DigitCount.NumberOfDigits(args[i]));
            Console.WriteLine(
                "The Factorial for [{0}] is [{1}]",
                num,
                // 调用 Factorial 类中的 Calc 静态方法:
                Factorial.Calc(num));
        }
    }
Beispiel #4
0
        static void Main(string[] args)
        {
            string s;

            Console.WriteLine("请输入字符串:");
            s = Console.ReadLine();
            Console.WriteLine("The Digit Count for String [{0}] is [{1}]"
                              , s, DigitCount.NumberOfDigits(s));
        }
Beispiel #5
0
    public static void Main(string[] args)
    {
        Console.WriteLine("Function Client");

        if (args.Length == 0)
        {
            Console.WriteLine("Usage: FunctionTest ...");
            return;
        }
        for (int i = 0; i < args.Length; i++)
        {
            int num = Int32.Parse(args[i]);
            Console.WriteLine(
                "The digit count from string [{0}] is [{1}]",
                args[i], DigitCount.NumberOfDigits(args[i]));
            Console.WriteLine(
                "The Factorial for [{0}] is [{1}]",
                num, Factorial.Calc(num));
        }
    }