- 博客(16)
- 资源 (8)
- 收藏
- 关注
转载 找出数组{1,2,3,4,...N-1}中出现的唯一重复数
异或法:/*找出数组{1,2,3,4,...N-1}中出现的唯一重复数 */#include /* run this program using the console pauser or add your own getch, system("pause") or input loop */using namespace std;int xor_findDup(int* a
2016-01-17 10:15:57 592
转载 找出数组中出现次数超过数组长度一半的数
/*找出数组中出现次数超过数组长度一半的数 */#include /* run this program using the console pauser or add your own getch, system("pause") or input loop */using namespace std;int main(int argc, char *argv[]) {
2016-01-16 09:27:24 448
转载 自行编写内存复制函数MyMemcpy()函数
/* 自行编写内存复制函数MyMemcpy()函数 */#include using namespace std;//-------------------------------------void* MyMemcpy(void* dest,const void* src,size_t count){// if(dest == NULL) return NULL;//
2016-01-15 18:58:06 1031 3
原创 自行编写数字转换成字符串Myatoi()函数
/* 自行编写数字转换成字符串Myatoi()函数 */#include using namespace std;//-------------------------------------int Myatoi(char* str){ int ret = 0; int i = 0; if(str==NULL) return 0; int flag = 1;
2016-01-15 18:20:11 809
原创 自行编写数字转换成字符串Myitoa()函数
/* 自行编写数字转换成字符串Myitoa()函数 */#include using namespace std;//-------------------------------------char* Myitoa(int num){ int flag = 0; if(num < 0) { flag = -1; num = -num; } //char*
2016-01-15 18:02:18 1995
原创 自行编写Strcpy()函数
/* 自行编写Strcpy()函数 */#include #include using namespace std;//-------------------------------------char* Strcpy(char* dest,const char* src){ if(dest == NULL) return NULL; if(src == NULL) re
2016-01-15 16:32:43 420
转载 不使用第三个变量,进行两个变量的值交换
/*不使用第三个变量,进行两个变量的值交换 */#include using namespace std;//-------------------------------------void swap1(int& a,int& b){ a = a+b; b = a-b; a = a-b;}void answer1(){ int a = 10; int b = 20
2016-01-15 15:31:30 374
原创 求1+2+3+...+n,要求不能使用乘,除,for ,while,if ,else ,switch,case
/*求1+2+3+...+n,要求不能使用乘,除,for ,while,if ,else ,switch,case */#include /* run this program using the console pauser or add your own getch, system("pause") or input loop */using namespace std;/*--
2016-01-15 15:12:21 419
原创 不使用流程控制语句,打印1~1000
#include /* run this program using the console pauser or add your own getch, system("pause") or input loop */using namespace std;//---------------------------#define X Y,Y,Y,Y,Y,Y,Y,Y,Y,Y#defin
2016-01-15 11:49:59 432
原创 a是数组名,(int*)(&a + 1)是什么意思呢
&a是 int (*) [5] 的类型,,&a+1 就加了 5*4个字节(5*4); sizeof(int (*)[5]) = 20; //sizeof(int[5]) = 20;pt 是 int * 的类型,,pt-1 就是 后退4个字节,因为sizeof(int * ) = 4#include #include /* run this program usi
2016-01-15 11:20:12 3772
原创 函数指针的使用
#include using namespace std;typedef void (*Func)(int,int);void sum(int a,int b){ cout << "a+b = " << a + b << endl;}void multi(int a,int b){ cout << "a*b = " << a*b << endl;}int main(in
2016-01-15 10:35:03 344
原创 常量指针 和 指针常量 的使用
#include //常量指针和指针常量的使用 int main(char argc,char* argv[]){ int a = 10; int b = 20; int c = 30; const int* pt1 = &a; //常量指针 pt1 = &b; printf("%d\n",*pt1); int* const pt2 = &c; //指针
2016-01-15 09:51:35 304
原创 可变参数求和
#include #include //可变参数求和 /* run this program using the console pauser or add your own getch, system("pause") or input loop */int sum(int count,...){ int* pt = &count +1; int i = 0; int ret =
2016-01-15 09:25:18 1117
转载 CPU大小端的判断
#include #include //X86 and MCU is little endian./* run this program using the console pauser or add your own getch, system("pause") or input loop */int checkType(){ unsigned int value = 0x1122;
2016-01-15 09:16:21 305
原创 使用 宏定义 实现的高级算法
#include #include #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */#define SOR(x) (x)*(x) //求平方#define Max(a,b) (((a)-(b))
2016-01-03 21:35:00 915
原创 类的成员函数作为回调函数
#include using namespace std;typedef void (*FuncPtr)(void); //定义回调函数,定义一个函数参数为空,返回值为空的函数指针,参数和返回值形式都一样,但功能不确定的函数class Test{ public: static void println(void) //作为参数的类成员函数必须声明为静态的 { c
2016-01-01 18:57:24 533
the java programming language fourth editionArnoldGoslingHolmes06
2014-08-30
vivi-boot loader
2014-08-30
BootLoader技术内幕
2014-08-30
ascii-码表
2014-08-30
国嵌_嵌入式Linux入门班实验手册
2014-08-30
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人