day1

51 阅读1分钟
using System;
namespace HelloWorldApplication
{
    class Demo
    {
        string name;
        //一定要添加public
        public bool Compare(int a, int b)
        {
            return a > b;
        }
        public  void PrintRectangle(int N)
        {
            int n = N;
            for (int i = 0; i < n; i++)
            {
                for (int j = i; j < n; j++)
                {
                    Console.Write(" ");
                }
                for (int j = 1; j <= (i + 1) * 2 - 1; j++)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }
        }
        //@符的使用   1.取消转义   2.可以输出多行字符串
        public void test2()
        {
            string str = @"ajfksjd
fksadjfk\nfjskjfajs";
            Console.WriteLine(str);
        }
    }
    class Programs
    {
        static void Main(string[] args)
        {
            //Demo demo = new Demo();
            //demo.PrintRectangle(10);
            //demo.test2();
        }
    }
    
}