摘要: #include <iostream>using namespace std;int Partition(int a[], int p1, int p2){ int temp = a[p1]; while (p1 < p2) { while (p1 < p2 && a[p2] > temp) p2--; a[p1] = a[p2]; while (p1 < p2 && a[p1] < temp) p1++; a[p2] = a[p1]; } a[p1] = temp; return p1;}void Q... 阅读全文
posted @ 2013-01-11 04:20 rookieeeeee 阅读(188) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;void bubbleSort(int a[],int n){ bool flag = true; for (int i = n - 1; flag && i > 0; i--) { flag = false; for (int j = 0; j < i; j++) { if (a[j] > a[j + 1]) { int temp = a[j]; a[j... 阅读全文
posted @ 2013-01-10 17:55 rookieeeeee 阅读(233) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;void insertSort(int a[], int n) { for (int i = 1; i < n; i++) { int temp = a[i]; int j = i - 1; for (; j >= 0 && a[j] > temp; j--) { a[j + 1] = a[j]; } a[j + 1] = temp; }// for (int i = 1; i < n... 阅读全文
posted @ 2013-01-10 03:16 rookieeeeee 阅读(164) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/hannosogno/article/details/6788276 1 #include <string> 2 #include<stdlib.h> 3 #include<stdio.h> 4 #include<conio.h> 5 #include<winsock2.h> 6 #include<windows.h> 7 #pragma comment(lib,"ws2_32.lib") 8 using namespace std; 9 10 void sbB 阅读全文
posted @ 2013-01-08 22:22 rookieeeeee 阅读(3344) 评论(0) 推荐(0) 编辑
摘要: class Ctest{public:void fun(){cout<<"fuck!"<<endl;}int nTest;};void (Ctest::*ptrFun)() = &Ctest::fun;int Ctest::*ptrTest = &Ctest::nTest;int main(){Ctest *ptrCtest = new Ctest();ptrCtest->*ptrTest = 100;cout<<ptrCtest->*ptrTest<<endl<<ptrCtest-&g 阅读全文
posted @ 2012-01-12 23:34 rookieeeeee 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 只要把你的函数写好并把地址传过去就行,至于如何调用你的函数,那你不需要管,调用部分的代码不是你写。#include <iostream>using namespace std;typedef void (*CALLBACK)(int a,int b);class base{private:int m;int n;static CALLBACK func;public:void registercallback(CALLBACK fun,int k,int j);void callcallback();};CALLBACK base::func=NULL;void base::reg 阅读全文
posted @ 2012-01-10 19:47 rookieeeeee 阅读(131) 评论(0) 推荐(0) 编辑
摘要: typedef struct node {int data1;char data2[10];node *next;}*ptrN;ptrN accessNode(const ptrN head,int n){ptrN tmpNode;if (head == 0){return 0;}else{tmpNode = head;}for (int i = 0;i < n-1; i++){if (tmpNode->next == 0){return 0;}tmpNode = tmpNode->next;}return tmpNode;}ptrN accessTrail(const pt 阅读全文
posted @ 2012-01-03 22:26 rookieeeeee 阅读(87) 评论(0) 推荐(0) 编辑
摘要: #include <afx.h>#include <iostream>#include <string>#include <vector>#include <io.h>#include <stdio.h>#include <fcntl.h>#include <boost/filesystem.hpp>#include <iostream> #include <boost/thread/thread.hpp> #include <string> #include & 阅读全文
posted @ 2012-01-03 19:25 rookieeeeee 阅读(177) 评论(0) 推荐(0) 编辑
摘要: #include <afx.h>#include <iostream>#include <string>#include <vector>#include <io.h>#include <stdio.h>#include <fcntl.h>#include <boost/filesystem.hpp>#include <iostream> #include <boost/thread/thread.hpp> #include <string> #include & 阅读全文
posted @ 2012-01-03 18:33 rookieeeeee 阅读(152) 评论(0) 推荐(0) 编辑
摘要: char * const p;char const * pconst char *p解答:char * const p; //常量指针,p的值不可以修改char const * p;//指向常量的指针,指向的常量值不可以改const char *p; //和char const *p[题目]const char *p="hello"; foo(&p);//函数foo(const char **pp)下面说法正确的是[]A.函数foo()不能改变p指向的字符串内容B.函数foo()不能使指针p指向malloc生成的地址C.函数foo()可以使p指向新的字符串常量D.函 阅读全文
posted @ 2011-12-31 10:28 rookieeeeee 阅读(252) 评论(0) 推荐(0) 编辑