自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(180)
  • 资源 (11)
  • 收藏
  • 关注

原创 谜题1.6 操作符的优先级和求值顺序

#include #include #define PRINT3(x, y, z) \printf(#x " = %d\t" #y " = %d\t" #z " = %d\n",x, y, z)int main(void){ int x, y, z; x = y = z = 1; ++x || ++y && ++z;PRINT3(x, y, z);

2011-11-30 23:04:02 601

原创 谜题1.5 关系操作符和条件操作符

#include #include #define PRINT(int) printf(#int" = %d\n",int)int main(void){ int x = 1, y = 1, z = 1; x += y += z; PRINT(x < y ? y : x); PRINT(x < y ? x++ : y++); PRI

2011-11-30 22:56:44 520

原创 谜题1.4 二进制位操作符

#include #include #define PRINT(int) printf(#int" = %d\n",int)int main(void){ int x, y, z; x = 03; y = 02; z = 01; PRINT(x | y & z); PRINT(x | y & ~z); PRINT(x ^ y & ~

2011-11-30 22:51:50 603

原创 谜题1.3 逻辑操作符和增量操作符

#include #include #define PRINT(int) printf("%d\n",int)int main(void){ int x, y, z; x = 2; y = 1; z = 0; x = x && y || z;PRINT(x); PRINT( x || !y && z); x = y = 1;

2011-11-30 22:46:41 635

原创 谜题1.2 赋值操作符

#include #define PRINTX printf("%d\n",x)int main(void){ int x = 2, y, z; x *= 3 + 2; PRINTX; x *= y = z = 4; PRINTX; x = y == z; PRINTX; x == (y = z);

2011-11-30 21:45:04 673

原创 谜题1.1 基本算术操作符

#include int main(void){ int x; x = -3 + 4 * 5 - 6; printf("%d\n",x); x = 3 + 4 % 5 - 6; printf("%d\n",x); x = -3 * 4 % -6 / 5; printf("%d\n",x); x = (7 + 6

2011-11-30 21:37:01 580

原创 这些你见过吧?

typedef T value_type;typedef T* pointer;typedef T* const const_pointer;typedef T& reference;typedef T& const const_reference;typedef size_t size_type;typedef ptrdiff_t difference_type;

2011-11-30 08:23:44 202

原创 深拷贝

什么时候调用拷贝构造函数1--->当一个对象以值传递的方式传入函数2--->当一个对象以值传递的方式返回函数3--->当用一个对象初始化另一个对象时拷贝构造函数分为浅拷贝和深拷贝当类拥有堆内存资源时,必须用深拷贝#include #include using namespace std;class DeepCopy{ public: De

2011-11-29 23:23:46 325

原创 二维数组与指针数组

//二维数组char wName[8][13] 1 2 3 4 5 6 7 8 9 10 11 12 13wName+0:------>s u n d a y \0 \0 \0 \0 \0 \0 \0wName+1:------>m o n d a y \0 \0 \0 \0 \0 \0 \0

2011-11-29 23:04:33 223

原创 指针数组与数组指针

/* 指针数组(int *p[2]):列不确定 数组指针(int (*p)[2]):行不确定*/#include using namespace std;int main(void){ //指针数组 int *p[2]; int a[4] = {11, 22, 33, 44}; int b[6] = {14, 25,

2011-11-29 22:47:54 289

原创 尽量将const写在类型后面

typedef string *pstring;         const pstring cstr;         请问cstr变量是什么类型?         const string * cstr         很多人以为是上面这个吧!         非也,它是下面这个         string * const cstr         所以,如果你将

2011-11-29 21:02:06 506 1

原创 用类似迭代器的方式输出数组

#include using namespace std;int main(void){ const size_t arr_sz = 5; int int_arr[arr_sz] = {0, 1, 2, 3, 4}; for (int *pbegin = int_arr, *pend = int_arr + arr_sz; pbegin != pend;

2011-11-29 20:35:27 280

原创 哥们,你见过这样的下标运算么?

#include using namespace std;int main(void){ int ia[] = {0, 2, 4, 6, 8}; int *p = &ia[2]; cout << *p << endl; int j = p[1]; cout << j << endl; int k = p[-2]; c

2011-11-29 20:31:27 199

原创 ptrdiff_t

#define __PTRDIFF_TYPE__ long inttypedef __PTRDIFF_TYPE__ ptrdiff_t;

2011-11-29 20:26:58 630

原创 指针与数组

#include using namespace std;int main(){ char ch[] = "hello world"; char *pch = "hello world"; cout << ch << endl; cout << pch << endl; return 0;}hello worldhell

2011-11-29 20:21:38 177

原创 NULL

#define NULL 0

2011-11-29 20:12:42 288

原创 strlen与sizeof

#include #include using namespace std;int main(void){ const char cArray[20] = "Daniel"; cout << strlen(cArray) << endl; cout << sizeof(cArray) << endl; return 0;}

2011-11-29 20:08:33 171

原创 数组的初始化

#include using namespace std;int array1[10];void output(){ int array2[10]; for (int i = 0; i < 5; ++i) { cout << i << "\t" << array2[i] << endl; }}void output1

2011-11-29 20:01:08 257

原创 等值首尾和

/* 功能:计算一个算组,它的前置和和后置和有多少个相等 例子:x[] = {3, 6, 2, 1, 4, 5, 2}; 前置和:3 9 11 12 16 21 23 后置和:2 7 11 12 14 20 23 作者:朱鑫 日期:2011/11/29*/#include using namespace

2011-11-29 17:21:48 572

原创 两数组最短距离

/* 功能:计算两个数组的最短距离 例子:x[] = {1, 3, 5, 7, 9}; y[] = {2, 6, 8}; min = 1; 作者:朱鑫*/#include #include using namespace std;int min_distance(int *, int *, int, in

2011-11-29 17:00:02 431

原创 双向链表

//Node.htemplate class Node{ public: T data; Node *lNode; Node *rNode; Node() { ; } Node(const T &x) { data = x; } ~Node(

2011-11-29 11:41:33 175

原创 循环链表

//Node.htemplate class Node{ public: Node() { ; } Node(const T &x) { data = x; } ~Node() { ; } T data; Node

2011-11-29 10:28:44 200

原创 单链表逆置(C++)

//结点类 template class Node{ public: Node() { ; } Node(const T &x) { data = x; } ~Node() { ; } T data; Node *

2011-11-28 21:13:43 344

原创 链表模板类

/* LinearList.h是基类 Node.h是结点类 SingleList.h是链表类 SingleList.cpp是SingleList.h的具体实现 main.cpp是测试*///LinearList.husing namespace std;template class LinearList{ public: Linear

2011-11-28 19:51:25 406

原创 等值数目

#include using namespace std;template int coincidenceCount(T*, T*, int, int);int main(void){ int m, n; int *piArray1; int *piArray2; while (cin >> m >> n) {

2011-11-28 11:49:53 269

原创 支配值数目

/* 已知f[]与g[]两个整数数组,元素都已经从小到大排列,试编写程序算出f[] 中每一个元素比g[]中元素大的个数的总数。换句话说,f[0]比g[]中多少个 元素大、f[1]比g[]中多少个元素大等,这些值的总和就是所要求的答案。*/#include using namespace std;template int dominantCount(

2011-11-28 11:34:59 256

原创 看一个例子,指针与数组的区别

#include using namespace std;int main(void){ char array[] = "Hello World"; const char *p = "Hello World"; cout << sizeof(array) / sizeof(*array) << endl; cout << sizeof(p) /

2011-11-28 11:11:35 265

原创 Stack模板

//Stack.htemplate class Stack{ public: Stack() { ; } virtual void Push(const T &x) = 0; virtual void Pop() = 0; virtual T Top() const = 0; virtua

2011-11-26 22:43:48 563 1

转载 C++内存分配

在C++中,内存分成5个区,他们分别是堆、栈、自由存储区、全局/静态存储区和常量存储区。 栈,就是那些由编译器在需要的时候分配,在不需要的时候自动清除的变量的存储区。里面的变量通常是局部变量、函数参数等。在一个进程中,位于用户虚拟地址空间顶部的是用户栈,编译器用它来实现函数的调用。和堆一样,用户栈在程序执行期间可以动态地扩展和收缩。  堆,就是那些由 new 分配的内存块,他们的释放

2011-11-26 21:58:30 437

原创 快速排序

#include using namespace std;const int MAXSIZE = 100;void quick_sort(int [], int, int);int main(void){ int n; int array[MAXSIZE]; while (cin >> n) { for (int i =

2011-11-26 19:24:40 252

原创 选择排序

#include const int MAXSIZE = 100;using namespace std;void select_sort(int [], int);int main(void){ int n; int array[MAXSIZE]; while (cin >> n) { for (int i = 0;

2011-11-26 18:59:54 257

原创 插入排序

/* 功能:插入排序 例如: 5 3 8 2 9 第一次 :5 5 8 2 9 3 5 8 2 9 第二次 :3 5 8 2 9 第三次 :3 5 8 8 9 3 5 5 8 9

2011-11-26 01:47:56 310

原创 华美海润的笔试题(C语言)

/* 求最大公约数*/#include using namespace std;int function(int a, int b){ while (b) { if (a > b) { a -= b; } else {

2011-11-25 12:30:29 2857

原创 华美海润的笔试题(数据库)

/* 建立数据库test1 建立数据表Teacher,Student,Grade 插入各表的数据*/create database test1;create table Teacher( TeacherId varchar(10) primary key, Name varchar(20), Email varchar(20),)insert int

2011-11-25 12:07:57 4388

原创 最小拉丁矩阵

#includeusing namespace std;int main(void){ int n; int temp; while (cin >> n) { for (int i = 1; i <= n; ++i) { temp = i; while (te

2011-11-22 23:29:20 404

原创 约瑟夫问题

#include #include #include using namespace std;char *chArray;void Joseph(int n, int m);int main(void){ int n, m; while (cin >> n >> m) { chArray = (char*)malloc((

2011-11-22 22:53:32 468 1

原创 大端模式和小端模式

#include using namespace std;int main(void){    cout << sizeof(char) << endl;    cout << sizeof(short) << endl;    cout << sizeof(int) << endl;    cout << sizeof(long) << endl;    cout

2011-11-22 22:01:16 222

原创 求每隔1000素数的个数

#include const int MAX = 1000000;using namespace std;bool isPrime(int n);int count(int n);int main(void){ for(int i = 0; i < MAX; i += 1000) { cout << count(i) <<endl;

2011-11-22 21:59:01 293

原创 指针常量与常量指针

在说道“指针常数”时,我们的意思是一个被声明为“char *const chrPtr”形式的指针,你不能把它修改为指向内存中另外一处的地址,但可以用它来改变它所指向的地址处的数据内容。这与更为常见的“常数指针”是有区别的。在说道“常数指针”时,我们的意思是一个被声明为“const char *chrPtr”形式的指针,你可以把它修改为指向内存中另外一处的地址,但不能用它来修改它所指向的地址

2011-11-22 19:40:42 279

原创 凯撒密码

文件结构如上图/* 作者:朱鑫 语言: C++ 说明:从in.txt读取明文或者密文,经过加密或者解密后输出到 out.txt中,如果out.txt与test.txt一样则加密或者解密 成功,否则,不成功。 日期:2011/11/21 邮箱:[email protected]*/#inc

2011-11-22 19:01:05 704

图书管理系统(数据库实习)

数据库实习论文,大家可以参考参考,有sql的实现,也有oracle的实现

2011-06-29

离散数学(方世昌)西安电子科技大学

离散数学,相当重要的一门课程,大家一定要学好

2011-06-15

MySQL驱动,编写java时用到

MySQL驱动,编写java时直接导入,即可实用

2011-06-11

n皇后问题(回溯法,C++)

n皇后问题相信大家早已熟悉了,用回溯法解,那是相当的简单。

2011-05-23

01背包问题(回溯法,C++写的)

01背包问题,是一个经典问题。用回溯法,当然是很好的选择,也容易理解

2011-05-23

快速排序(大一的过来看看)

快速排序是非常高效的排序算法,当然你可以用系统的库函数。但是,自己写的不是更加给力么?

2011-05-23

汉诺塔问题(递归,C++)

汉诺塔,相信大家早已熟悉了。用递归做,既简单,又好懂。所以,上传上来,给大家看看。

2011-05-23

布线问题(分支限界法)

布线问题,和迷宫问题是同一类问题。都是通过广度优先搜索来解决的。当然,深度就更好了。

2011-05-22

循环赛日程表(分治递归法)

循环赛日程表是非常典型的分治递归的例子,也的一个稍微有点难的问题。但是,我相信大家一定没问题

2011-05-22

m着色问题(回溯法)

m着色问题,用C++写的,回溯法写的,其实就和n皇后问题非常类似,相信大家一定没问题吧

2011-05-22

桌面搜索小工具(java)

用java写的一个桌面搜索小工具,可以实现文件搜索和文本检索。

2011-05-22

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除