ex-16-04

来自「Programming Csharp Source Code(代码) Prog」· 代码 · 共 37 行

TXT
37
字号
// Example 16-04: A client program to test the calculator web service

using System;

// driver program to test the web service
public class Tester
{
   public static void Main()
   {
      Tester t = new Tester();
      t.Run();
   }

   public void Run()
   {
      int var1 = 5;
      int var2 = 7;

      // instantiate the web service proxy
      WSCalc.Service1 theWebSvc = 
         new WSCalc.Service1();

      // cal the add method
      Console.WriteLine("{0} + {1} = {2}", var1, var2,
         theWebSvc.Add(var1, var2));

      // build a table by repeatedly calling the pow method
      for (int i = 2;i<10; i++)
         for (int j = 1;j <10;j++)
         {
            Console.WriteLine("{0} to the power of {1} = {2}", i, j,
               theWebSvc.pow(i, j));
         }
   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?