Visitors hit counter dreamweaver

04 2014 档案

摘要:对给定字符串删除特定字符或者是特定字符串。对字符串操作一定要注意结束符'\0'的处理。// StrDeleteChar.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"void StrDeleteChar(char *str, char ch){//删除字符串s... 阅读全文
posted @ 2014-04-16 22:26 Jason Damon 阅读(358) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include #include using namespace std;#define Element char#define Format "%c"//构造树节点typedef struct Node{ Element data; struct Node *lchild; struct Node *rchild;}*Tree;int index = 0;//构造二叉树,按照先序遍历构造二叉树//无左子树或者右子树用"#"表示void TreeConstructor(Tree &root, 阅读全文
posted @ 2014-04-10 21:14 Jason Damon 阅读(1670) 评论(0) 推荐(0) 编辑
摘要:今天写快排的时候,突然想到我们到底可以用多少种方法来实现交换两个变量的值呢。然后就搜了下,总结出了如下几种,亲测都可以运行。但我用的是交换两个数组元素的值,那么如果当两个元素相等时,前两种方法是不能正确交换,而是得到0.具体原因现在我还不是很清楚。比较推荐的还是地三种和最后一种方法。#define SWAP(a,b) {a = a^b; b = a^b; a= a^b;}#define SWAP(a,b) {a = a + b; b = a - b; a= a - b;}#define SWAP(a,b) {typeof(a) t = a; a = b; b = t;}#define SW.. 阅读全文
posted @ 2014-04-02 12:00 Jason Damon 阅读(368) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示