随笔分类 -  C#

插入排序(C#)
摘要:usingSystem;publicclassInsertionSorter{publicvoidSort(int[]list){for(inti=1;i<list.Length;++i){intt=list[i];intj=i;while((j>0)&&(list[j-1]>t)){list[j]=list[j-1];--j;}list[j]=t;}}}publ... 阅读全文

posted @ 2006-03-04 16:38 阿伟 阅读(386) 评论(1) 推荐(0)

快速排序(c#)
摘要:usingSystem;namespaceQuickSorter{publicclassQuickSorter{privatevoidSwap(refintl,refintr){ints;s=l;l=r;r=s;}publicvoidSort(int[]list,intlow,inthigh){intpivot;intl,r;intmid;if(high<=low)return;elseif... 阅读全文

posted @ 2006-03-04 13:58 阿伟 阅读(859) 评论(0) 推荐(0)

一些字符串操作的常用用法
摘要://获得汉字的区位码  byte[] array = new byte[2];  array = System.Text.Encoding.Default.GetBytes("啊");int i1 = (short)(array[0] - ''\0'');  int i2 = (short)(array[1] - ''\0'');//unicode解码方式下的汉字码  array = System... 阅读全文

posted @ 2006-03-01 17:41 阿伟 阅读(284) 评论(0) 推荐(0)

C#常用函数
摘要:1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=currentTime.Month; 1.4 取当前日 int 日=curr... 阅读全文

posted @ 2006-03-01 11:09 阿伟 阅读(238) 评论(0) 推荐(0)

导航