随笔分类 -  C#与.net

摘要:1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Program 9 {10 // 要理解递归,先要理解递归. (这只是一句玩笑话 )11 // 递归,顾名思义就是递来归去,如此反复,直到不符合某个条件. 而函数递归意思也就是函数调用函数自己. 下面用代码来示例:12 13 static in... 阅读全文
posted @ 2012-09-05 20:44 梦断难寻 阅读(5094) 评论(0) 推荐(0)
摘要:1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Program 9 { 10 /* 先来了解一下什么是实参, 什么是形参. 11 所谓形参其实也就是说函数定义的时候所带的参数. 比如 static void Myfuntion(int i , int t) 其中 int ... 阅读全文
posted @ 2012-09-04 21:58 梦断难寻 阅读(7711) 评论(0) 推荐(0)
摘要:1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Program 9 {10 // 函数的定义方法11 // 修饰符 返回值 函数名 (参数)12 // 定义函数. ↓13 static void MyFuntion1(int i, int t) //一个无返回值的函数, (Vo... 阅读全文
posted @ 2012-09-04 21:18 梦断难寻 阅读(16975) 评论(0) 推荐(0)
摘要:1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Program 9 {10 static void Main(string[] args) ... 阅读全文
posted @ 2012-09-02 22:39 梦断难寻 阅读(47344) 评论(2) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { //声明数组. 第一种方法. 声明并分配元素大小. int[] Myint = new int[30]; Myint[0] = 30; Myint... 阅读全文
posted @ 2012-09-02 20:57 梦断难寻 阅读(60629) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { int Cock, Hen, Chick; //For循环版本百钱百鸡 for (Cock = 0; Cock < 19; Cock++) //因为公鸡最大不会超过... 阅读全文
posted @ 2012-09-01 21:36 梦断难寻 阅读(5609) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication2{ enum Day //枚举类型 { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday } class Program { static void Main... 阅读全文
posted @ 2012-08-31 17:30 梦断难寻 阅读(15725) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { // 一个石头剪刀布的游戏,下面代码其实可以封装成函数或者过程,封装成函数或者过程会代码更简单,更清晰. 但是由于刚开始学C#,学到了面向对象的方法时再封装吧. Random Rd = new... 阅读全文
posted @ 2012-08-31 17:28 梦断难寻 阅读(4631) 评论(0) 推荐(0)
摘要:1 //建立一个控制台程序,把下面代码复制进去 Ctrl + F5运行 2 3 using System; 4 using System.Collections.Generic; 5 using System.Linq; 6 using System.Text; 7 8 namespace ConsoleApplication1 9 {10 class Program11 {12 static void Main(string[] args)13 {14 int[] my = new int[10]; //定义一个... 阅读全文
posted @ 2012-08-29 21:49 梦断难寻 阅读(708) 评论(0) 推荐(0)
摘要:代码清单 :using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication{ class Program { static void Main(string[] args) { //定义两个变量. int i = 23, j = 45; //输出 Console.WriteLine("{0} + {1} = {2... 阅读全文
posted @ 2012-08-24 23:22 梦断难寻 阅读(2786) 评论(0) 推荐(0)
摘要:1.数学运算符. 2.赋值运算符 3. 运算符的优先级 阅读全文
posted @ 2012-08-23 21:55 梦断难寻 阅读(479) 评论(0) 推荐(0)
摘要:1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace OneCshapApplication 7 { 8 class Program 9 {10 static void Main(string[] args)11 {12 //定义几个变量,13 int age; //整形14 string Name; //字... 阅读全文
posted @ 2012-08-23 21:45 梦断难寻 阅读(413) 评论(0) 推荐(0)