摘要: 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 梦断难寻 阅读(60583) 评论(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 梦断难寻 阅读(5581) 评论(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 梦断难寻 阅读(15687) 评论(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 梦断难寻 阅读(4618) 评论(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 梦断难寻 阅读(699) 评论(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 梦断难寻 阅读(2775) 评论(0) 推荐(0) 编辑
摘要: 1.数学运算符. 2.赋值运算符 3. 运算符的优先级 阅读全文
posted @ 2012-08-23 21:55 梦断难寻 阅读(461) 评论(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 梦断难寻 阅读(402) 评论(0) 推荐(0) 编辑
摘要: 1.WSAstartup (连接WinSocket库)原型如下: Int WSAStartup ( Word WVersionregusested, LPWSADATA LPWSAData ); 在delphi中定义如下: function WSAStartup(wVersionRequired: word; var WSData: TWSAData): Integer; stdcall;应用程序在使用Winsock API之前必须调用此函数,只有当此函数返回(表示应用程序与Winsock库成功建立起连接),应用程序才可以调用其它WindowsSockets DLL 中的函数.---... 阅读全文
posted @ 2012-07-19 16:44 梦断难寻 阅读(2527) 评论(0) 推荐(0) 编辑
摘要: 代码清单:以下程序同时扮演了客户端与服务端.添加一个button,两个Edit,一个ClientSocket,一个ServerSocket.-------------------------------------------------------------------------------------------------------------------------------------------------------unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, Syst 阅读全文
posted @ 2012-07-16 00:19 梦断难寻 阅读(4749) 评论(0) 推荐(0) 编辑