C#方法(函数)
2021-05-04 15:29
标签:blog names 均值 stat div span code system 字符串数组 C#方法(函数) 标签:blog names 均值 stat div span code system 字符串数组 原文地址:http://www.cnblogs.com/happyzwt/p/7712662.html 1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 namespace _04.方法_函数_
8 {
9 class Program
10 {
11 static void Main(string[] args)
12 {
13 //求2个整数的最大值
14 //int max = Program.GetMax(1, 2);
15 //Console.WriteLine("最大值为{0}", max);
16 //Console.ReadKey();
17
18 //判断闰年
19 //bool b = IsRun(2100);
20 //Console.WriteLine(b);
21 //Console.ReadKey();
22
23 //输入数字跳出循环,否则继续
24 //Console.WriteLine("请输入一个数字");
25 //string input = Console.ReadLine();
26 //int number = GetNum(input);
27 //Console.WriteLine(number);
28 //Console.ReadKey();
29
30 //输入yes\no,否则继续
31 //Console.WriteLine("请输入yes\no");
32 //string input = Console.ReadLine();
33 //string result = IsYesOrNo(input);
34 //Console.WriteLine(result);
35 //Console.ReadKey();
36
37 //求数组的和
38 //int[] nums = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
39 //int result = GetSum(nums);
40 //Console.WriteLine(result);
41 //Console.ReadKey();
42
43 //求数组的最大、最小、总和、平均值
44 //int[] nums = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
45 //int max = 0;
46 //int min = 0;
47 //int sum = 0;
48 //int avg = 0;
49 //Test(nums,out max,out min,out sum,out avg);
50 //Console.WriteLine(max);
51 //Console.WriteLine(min);
52 //Console.WriteLine(sum);
53 //Console.WriteLine(avg);
54 //Console.ReadKey();
55
56 //判断登录条件
57 //Console.WriteLine("username");
58 //string username = Console.ReadLine();
59 //Console.WriteLine("password");
60 //string password = Console.ReadLine();
61 //string msg;
62 //bool b = IsLogin(username, password, out msg);
63 //Console.WriteLine(b);
64 //Console.WriteLine(msg);
65 //Console.ReadKey();
66
67 //交换2个int型的整数
68 //int n1 = 10;
69 //int n2 = 20;
70 //Change(ref n1, ref n2);
71 //Console.WriteLine("{0}, {1}", n1, n2);
72 //Console.ReadKey();
73
74 //输入姓名、学号、成绩,计算总成绩
75 ////int[] s = { 99, 99, 99 };
76 //Score("张三", 101, 99, 99, 99);
77 //Console.ReadKey();
78
79 //方法递归
80 //TellStory();
81 //Console.ReadKey();
82
83 //方法综合练习6.7.12
84
85 //求一个字符串数组中最长的元素
86 //string[] names = { "马云", "罗振宇", "科比布莱恩特", "扎克伯格"};
87 //Console.WriteLine(GetLongStr(names));
88 //Console.ReadKey();
89 }
90
91 #region 2个数的最大值
92 ///
上一篇:c# 之简单工厂模式
下一篇:C#生成不重复的随机数