随笔分类 - C#基础
摘要:namespace 二分法{ class Program { static void Main(string[] args) { //二分法前提:数组必须是有序的。 int[] a = new int[] { 3, ...
阅读全文
摘要:namespace 输入一个年份是否为闰年{ class Program { static void Main(string[] args) { while (true) { Console.WriteLine("请输入年份:"); int a = Convert.ToInt32(Console.R...
阅读全文
摘要:namespace 运算符穷举{ class Program { static void Main(string[] args) { //123()45()68=100; 在括号里面添加+-使等式成立 int a; int b; for (int i = 0; i < 2; i++)//有0 和...
阅读全文
摘要:namespace 兔子生兔子函数递归{ class Program { static void Main(string[] args) { Console.WriteLine("请输入你想知道兔子哪个月的数量:"); int m = Convert.ToInt32(Console.ReadLine...
阅读全文
摘要:namespace 找到一段话中第二个关键字的位置{ class Program { static void Main(string[] args) { //找第二个a string s = "cabcaceadf"; int n = s.IndexOf("a"); //找到第一个a的索引n str...
阅读全文
摘要:namespace 赶羊递归 { class Program { public int jisuan(int day) //创建一个函数,输入day计算出羊的总数 { int sum=0; if(day==7) { sum = 2; return sum; //一定要加return截止 } su...
阅读全文
摘要:namespace 函数数组排序带出最大最小值及平均值{ class Program { static void Main(string[] args) { int[] b=new int[]{9,1,5,3,7}; int max = 0; //设置两个变量用来接收最低值与最小值。 int mi...
阅读全文
摘要:namespace 一元二次方程函数解决{ class Program { static void Main(string[] args) { while (true) { Console.WriteLine("请为一元二次方程ax²+bx+c设置相关参数:"); Console.WriteLin...
阅读全文
摘要:namespace 函数__青歌赛打分{ class Program { public int[] Array(int[] a) //排序 { int n = a.Length; for (int i = 1; i <= a.Length; i++) { for (int j = 1; j <= a...
阅读全文
摘要:namespace 随机生成手机号{ class Program { static void Main(string[] args) { while (true) { long[] array = new long[10]{13581049314,18366885682,13626435731,1...
阅读全文
摘要:using System;using System.Collections.Generic;using System.Text;using System.Threading;namespace 用函数把闹钟习题练一练无返回值{ class Program { public void naozhong...
阅读全文
摘要:namespace 函数冒泡排序{ class Program { static void Main(string[] args) { int[] b = new int[5] { 1,5,3,4,2}; new Program().Array(b); //数组b调用已经写好的Array函数用来排...
阅读全文
摘要:namespace 函数{ //函数的作用:提高代码的重用性,一块封闭的代码块。 //语法结构:返回值(当执行完函数之后,返回的结果的数据类型),函数名,输入参数,输出参数,函数体。 //一:无返回值,无参数的函数 /* public void dayin() //只是调用,不需要返回值 { Con...
阅读全文
摘要:namespace 火影忍者多人对战{ class Program { //创建一个Player的结构体 struct Player { public string name; public int hp; public int attack; public int defend; public i...
阅读全文
摘要:namespace 商场打折结构体{ class Program { struct ZhuangBei { public string name; public double price; public int amount; } static void Main(string[] args) {...
阅读全文
摘要:using System;using System.Collections;using System.Collections.Generic;using System.Text;namespace 结构体冒泡排序{ class Program { struct student { public st...
阅读全文
摘要:using System;using System.Collections;using System.Collections.Generic;using System.Text;namespace ArrayList集合排序{ class Program { struct Player { publ...
阅读全文
摘要:namespace 英雄联盟对战{ class Program { struct player { public string name; public int hp; public int gj; public int fy; public int dj; public jn jineng; /...
阅读全文
摘要:namespace 结构体英雄联盟练一练{ class Program { struct player { public string name; public int dengji; public zy z; public zb cz; } struct zy { public int ll; p...
阅读全文
摘要:namespace 结构体_枚举类型{ class Program { struct jiegouti { public int fenshu; public string name; public string kecheng; } static void Main(string[] args) ...
阅读全文