首页 > 其他 > 详细

18._3分部类概述及其使用

时间:2016-07-02 22:42:40      阅读:211      评论:0      收藏:0      [点我收藏+]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _18._3分部类概述及其使用
{

    partial class atithmetic //阶乘
    {
        public int factorial(int num)
            {
            int factorial = 1;
        for(int i =num;i>0;i--)
            factorial*=i;
            return factorial;
            }
    }


    partial class atithmetic //平方
    {
        public int square(int num)
        {
            return num * num;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            atithmetic a = new atithmetic();
            int num = 5;
            Console.WriteLine("调用分部类的第一部分:{0}",a.factorial(num));
            Console.WriteLine("调用分部类的第二部分:{0}",a.square(num));
            Console.Read();
        }
    }
}

 

18._3分部类概述及其使用

原文:http://www.cnblogs.com/zqyo2000z/p/5636150.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!