摘要: //将一个二维数组的行和列交换,存储到另外一个数组中 //int[,] a = new int[2, 3] { { 1, 2 ,3},{ 4, 5, 6 } }; // int[,] b = new int[a.GetLength(1), a.GetLength(0)]; // for (int i 阅读全文
posted @ 2016-09-29 22:06 无畏先锋 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 数组定义,数组初始化:动态初始化,静态初始化 int[ ] array=new int[6]; new 是运算符;数值类型初始值为0,bool类型是false,字符串初始值null. 动态初始化:数据类型[] 数组名=new 数据类型[数组长度]{元素1,元素2}; //数组的动态初始化 int[] 阅读全文
posted @ 2016-09-29 22:04 无畏先锋 阅读(124) 评论(0) 推荐(0) 编辑
摘要: //定义一个变量记录圈数,循环变量初始化 int i = 0; //执行循环的条件即循环条件 while (i < 10) { Console.WriteLine("跑" + i); i++; //i是循环变量 //条件越来越不满足,最终跳出循环 } //for(循环变量初始化;条件判断;循环变量变 阅读全文
posted @ 2016-09-29 21:54 无畏先锋 阅读(164) 评论(0) 推荐(0) 编辑
摘要: switch (date) { case 1: Console .WriteLine("周一" ); break ; case 2: Console .WriteLine("周二" ); break ; case 3: Console .WriteLine("周三" ); break ; case 阅读全文
posted @ 2016-09-29 21:44 无畏先锋 阅读(167) 评论(0) 推荐(0) 编辑
摘要: /*数据类型转换 1.隐式转换,用在都是数值类型的两个数据之间; 转换的条件:从取值范围小的往范围大的类型转换,从精确度低往精确度高转,两个条件同时满足 2.强制类型转换 (1)使用类型转换符 (2)把字符串转换成其它格式有两种方法,第一种是Convert,第二种是Parse */ int a = 阅读全文
posted @ 2016-09-29 21:39 无畏先锋 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 一:输入函数: 1: string a = Console.ReadLine(); 将输入的字符串放入变量a中; 2: int a = Console.Read(); 将输入的字符串的第一个字符的ASC码存入整形变量a中; 二:换行(在下一行执行): Console.WriteLine(); 输入: 阅读全文
posted @ 2016-09-29 21:37 无畏先锋 阅读(2673) 评论(0) 推荐(0) 编辑
摘要: 注释,单行,多行,注释函数 定义变量, 交换两个int变量的值(int a,int b) /int c;c=a;a=b;b=c; /a=a+b;b=a-b;a=a-b; 变量命名规则: 1.相同变量名不能重复定义 2.只能包含数字,字母,下划线,并且数字不能开头 3.区分大小写,num,Num 4. 阅读全文
posted @ 2016-09-29 21:05 无畏先锋 阅读(205) 评论(0) 推荐(0) 编辑