zoukankan      html  css  js  c++  java
  • 函数的输入,输出

    namespace HanShu
    {
        class Class1
        {
            /// <summary>
            /// 这是一个加法运算的函数
            /// </summary>
            /// <param name="a"></param>
            /// <param name="b"></param>
            /// <returns></returns>
            public int JiaFa(int a, int b)
            {
                return a + b;
            }

            /// <summary>
            /// 无返回值,无参数
            /// </summary>
            public void DaYin()
            {
                Console.WriteLine("helloworld");
            }

            /// <summary>
            /// 累加求和
            /// </summary>
            /// <param name="n"></param>
            /// <returns></returns>
            public int Qiuhe(int n)
            {
                int sum = 0;
                for (int i = 1; i <= n; i++)
                {
                    sum += i;
                }

                return sum;
            }

        }
    }
    namespace HanShu
    {
        class Program
        {
            //函数:是一个带有输入参数、输出参数、返回值的代码块
           
            static void Main(string[] args)
            {
                int a, b;
                a = 3;
                b = 5;


                Class1 cc = new Class1();
                int c = cc.JiaFa(a,b);

                Console.WriteLine(c);

                cc.DaYin();

                Console.WriteLine(cc.Qiuhe(5));
                Console.ReadLine();
            }
        }
    }

  • 相关阅读:
    LINQ to XML一些基本查询
    系统二级域名配置说明
    分布式文件系统部署Hadoop【转载】
    5 ways to instantly appear more confident
    hadoop Namenode和DataNode架构分析
    Employee burnout: Around the corner? Already here?
    阿里巴巴分布式服务框架 Dubbo 团队成员梁飞专访
    eclipse web项目 分多个源文件目录
    配置VS2008本地调试.NETFRAMEWORK源代码
    Google搜索指令大全
  • 原文地址:https://www.cnblogs.com/liuyuwen900326/p/4184161.html
Copyright © 2011-2022 走看看