diff --git "a/\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/Program.cs" "b/\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/Program.cs" new file mode 100644 index 0000000000000000000000000000000000000000..7c2d3059bb65a72a1cd644ac85b1ac2f10ef6f6b --- /dev/null +++ "b/\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/Program.cs" @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 +{ + class Program + { + static void Main(string[] args) + { + + + Text1(); + + } + + static void Text1() { + + //1.定义一个计算图形面积的类,类中定义2个计算面积的方法(重载), + //分别计算圆面积和长方形面积两个方法。 + //提示:计算圆的面积传半径,计算长方形面积传长和宽。。 + + staff S = new staff(6); + S.yuanx(); + + + staff A = new staff(10,10); + A.changfangx(); + + }//圆形长方形面积 + static void Text2() { + + SumUtils S = new SumUtils(3,4); + S.Intron(); + }//两数相加 + static void Text3() { + SumUtils D = new SumUtils(3.5,3.5); + D.point(); + }//小数相加 + static void Text4() { + + SumUtils word = new SumUtils("牛","马"); + word.text(); + }//字符串相加 + static void Text5() { + SumUtils A = new SumUtils(6); + A.number(); + }//1指定另一个数累加 + } +} diff --git "a/\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/SumUtils.cs" "b/\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/SumUtils.cs" new file mode 100644 index 0000000000000000000000000000000000000000..3472b398b1404a3587145e4c638ff4e732c26933 --- /dev/null +++ "b/\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/SumUtils.cs" @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 { + + class SumUtils + { + public int Num1 { get; set; } + public int Num2 { get; set; } + + public double D1 { get; set; } + public double D2 { get; set; } + + public string S1 { get; set; } + public string S2 { get; set; } + + public int N1 { get; set; } + + + public SumUtils(int num1, int num2) { + this.Num1 = num1; + this.Num2 = num2; + + } + + public void Intron (){ + Console.WriteLine("两数相加的结果是:"+ (this.Num1+this.Num2)); + } + + public SumUtils(double d1,double d2) { + this.D1 = d1; + this.D2 = d2; + } + + public void point( ) { + Console.WriteLine("两个小数相加和是:"+(this.D1+this.D2)); + } + + public SumUtils(string s1,string s2) { + this.S1 = s1; + this.S2 = s2; + } + + + public void text() { + + Console.WriteLine("字符串相加 你是什么 "+(this.S1+this.S2)); + } + + + + public SumUtils(int n1) + { + this.N1 = n1; + } + + public void number() { + int sum = 0; + for (int i = 1; i <=N1; i++) + { + sum = sum + i; + } + Console.WriteLine("从1到"+N1+"相加和是:"+sum); + } + + } +} diff --git "a/\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/staff.cs" "b/\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/staff.cs" new file mode 100644 index 0000000000000000000000000000000000000000..5333d867097225e524898952e1cf4ef452867dd5 --- /dev/null +++ "b/\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/staff.cs" @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 +{ + class staff + { + + public double R { get; set; } + + public int L { get; set; } + public int W { get; set; } + + public staff(double r) { + this.R = r; + } + + public void yuanx() { + double result; + result = R * R * 3.14; + Console.WriteLine("圆的面积是{0}",result); + } + + public staff(int l,int w) { + this.L = l; + this.W = w; + + } + + public void changfangx() { + int result; + result = L * W; + Console.WriteLine("长方形的面积是{0}",result); + } + + } +}