上一页 1 ··· 3 4 5 6 7 8 9 10 下一页
摘要: /* 二分查找示例示例 -- 只适合已排序数组 Wirtten by: nick Date: 2012-10-16 12:13*/#include <iostream>#include <iomanip>using namespace std;bool binarySearch(int list[], int end, int target, int& index);int main(){ int a[10] = {0,1,2,3,4,5,6,7,8,9}; //已排序数组 int ans=0; if(binarySearch(a, 9, 6, ans))... 阅读全文
posted @ 2012-10-16 14:55 wouldguan 阅读(353) 评论(0) 推荐(0)
摘要: /* 顺序查找示例示例 Wirtten by: nick Date: 2012-10-16 12:13*/#include <iostream>#include <iomanip>using namespace std;bool seqSearch(int list[], int last, int target, int& index);int main(){ int a[10] = {3,4,6,3,2,8,4,0,5,7}; int ans=0; if(seqSearch(a, 9, 6, ans)) cout << "Find! i 阅读全文
posted @ 2012-10-16 14:40 wouldguan 阅读(807) 评论(0) 推荐(0)
摘要: /* 插入排序示例 Wirtten by: nick Date: 2012-10-16 12:13*/#include <iostream>#include <iomanip>using namespace std;void insertionSort(int list[], int last);void insertOne(int list[], int current, int last);int main(){ int a[10] = {3,4,6,3,2,8,4,0,5,7}; insertionSort(a, 9); for(int i=0; i<... 阅读全文
posted @ 2012-10-16 14:25 wouldguan 阅读(339) 评论(0) 推荐(0)
摘要: /* 冒泡排序示例 Wirtten by: nick Date: 2012-10-16 12:13*/#include <iostream>#include <iomanip>using namespace std;void bubbleSort(int list[], int last);void bubbleUp(int list[], int current, int last);int main(){ int a[10] = {3,4,6,3,2,8,4,0,5,7}; bubbleSort(a, 9); for(int i=0; i<10; i++... 阅读全文
posted @ 2012-10-16 12:27 wouldguan 阅读(373) 评论(0) 推荐(0)
摘要: /* 选择排序实例 Wirtten by: nick Date: 2012-10-16 12:13*/#include <iostream>#include <iomanip>using namespace std;void selectionSort(int list[], int last);void exchangeSmallest(int list[], int current, int last);int main(){ int a[10] = {3,4,6,3,2,8,4,0,5,7}; selectionSort(a, 9); for(int ... 阅读全文
posted @ 2012-10-16 12:15 wouldguan 阅读(254) 评论(0) 推荐(0)
摘要: {在左上角显示时间}procedure ThreadProc;var hScreenDC: hdc; SystemTime: _SYSTEMTIME; Temp: string; MyOutput: PChar;begin while true do begin Sleep(100); hScreenDC := GetDC(0); GetLocalTime(SystemTime); Temp := format('Current Time is %d-%d-%d %d:%d:%d', [SystemTime.wYear, SystemTime.wM... 阅读全文
posted @ 2012-06-02 21:33 wouldguan 阅读(329) 评论(0) 推荐(0)
摘要: class Program { static void Main(string[] args) { string a = "abc"; string b = "bcd"; method(a,b); Console.WriteLine("a:" + a + "b:" + b); } static void method(string a, string b) { string temp = a; a = b; b = temp; Console.WriteLine("a:" + a +... 阅读全文
posted @ 2012-05-21 23:10 wouldguan 阅读(149) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2012-04-21 22:12 wouldguan 阅读(317) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2012-04-21 21:23 wouldguan 阅读(190) 评论(0) 推荐(0)
摘要: 测试代码如下: class Program { static void Main(string[] args) { string strText = "Hello from all the guys at Wrox Press. "; strText += "We do hope you enjoy this book as much as we enjoyed writing it."; Stopwatch time1 = new Stopwatch(); time1.Start(); for (int j = 0; j < ... 阅读全文
posted @ 2012-04-21 20:46 wouldguan 阅读(277) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 下一页