using System;
public class Test
{
    public static void Main()
    {
        int n;
        while ((n = int.Parse(Console.ReadLine()))!=42)
            Console.WriteLine(n);
    }
}

1.不能去掉using System;

会报错

Solution to TEST in C#

2.这里不需要namespace,就连public都可以去掉
3.最简单格式的命令行程序就是

class  类名

{

  public static void Main()
    {

    }

}

相关文章:

  • 2021-07-12
  • 2022-12-23
  • 2021-10-03
  • 2021-12-28
  • 2021-11-29
  • 2021-11-18
  • 2021-05-27
  • 2021-10-21
猜你喜欢
  • 2021-12-05
  • 2021-09-04
  • 2022-12-23
  • 2021-08-29
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案