- 博客(33)
- 资源 (3)
- 收藏
- 关注
转载 vs运行mapx插件问题解决
运行一个C++工程,调用mapx控件时出现:This version of MapX cannot be used to develop applications. Please contact MapInfo authorized distributor to purchase MapX SDK 解决方案:对
2013-12-10 15:30:47
390
原创 中缀表达式直接转换为表达式二叉树、前缀表达式、后缀表达式,表达式求值
#include#include#include#include#includeusing namespace std;struct TreeNode{ string key; TreeNode* left; TreeNode* right;};stack opt;stack subexp;stack bracket;stack fun;stack param
2013-06-21 14:29:36
594
原创 大整数乘法
#include#includeusing namespace std;int result[200];void mul(string n1,string n2){ unsigned long len1=n1.length(); unsigned long len2=n2.length(); int carry=0; for(int k=len1+len
2013-06-14 15:57:26
290
原创 大整数加减法
#include#includeusing namespace std;void swap(string& str1,string& str2){ if(str1.length()<=str2.length()) { string tmp=str1; str1=str2; str2=tmp; return ;
2013-06-14 12:18:30
340
原创 大整数加减法运算
#include#includeusing namespace std;void swap(string& str1,string& str2){ if(str1.length()length()) { string tmp=str1; str1=str2; str2=tmp; return ; }else {
2013-06-14 01:21:45
348
原创 更复杂的中缀表达式转换为表达式二叉树
这个版本中的程序实现了将更复杂的中缀表达式直接转换为表达式二叉树,主要做了以下改进:一、将中缀表达式直接转换为表达式二叉树二、表达式操作数可以为标识符,函数调用(对于函数调用,仅仅将函数调用实现为一个节点,而没有进一步分析参数列表中的参数)三、实现了表达式二叉树的前缀(波兰式)、中缀、后缀(逆波兰式)输出具体程序如下:#include#include#include#incl
2013-06-09 18:57:39
572
原创 更复杂的中缀表达式转换为表达式二叉树
#include#include#include#includeusing namespace std;struct TreeNode{ string key; TreeNode* left; TreeNode* right;};stack opt;stack subexp;stack bracket;stack fun;stack param;bool T
2013-06-08 21:09:30
324
原创 中缀表达式直接生成表达式二叉树
#include#include#includeusing namespace std;struct TreeNode{ char key; TreeNode* left; TreeNode* right;};stack opt;stack subexp;stack bracket;//检查表达式中括号是否匹配bool TestBrackets(string ex
2013-06-08 18:09:32
833
原创 插入排序
#includeusing namespace std;void insertSort(int a[],int begin,int end){ for(int i=begin+1;i<=end;i++) { int j=begin; while(j<i) { if(a[j]>a[i])
2013-06-08 00:00:58
218
原创 归并排序
#includeusing namespace std;int merge(int a[],int i,int k,int j){ int* p=new int[j-i+1]; int tmp=0; int m=i; int n=k+1; while(m<=k&&n<=j) { if(a[m]<a[n]) {
2013-06-06 23:06:37
246
原创 中缀表达式转换为前缀表达式
#include#include#include#includeusing namespace std;stackopt;stacksubexp;string InfixToPrefix(string exp,int len){ for(int i=len-1;i>=0;i--) { if(exp[i]>='0'&&exp[i]<='9') { subexp.
2013-06-06 13:50:02
316
原创 aaa
#includeusing namespace std;int main(){cout<<"hello world !"<<endl;return 0;}
2013-06-06 00:43:18
119
原创 归并排序
#includeusing namespace std;int merge(int a[],int i,int k,int j){ int* p=new int[j-i+1]; int tmp=0; int m=i; int n=k+1; while(mk) { while(n<=j) { p[tmp]=a[n]; n++; tmp++; } } if(n>j) { while(m=j) {
2013-06-05 23:30:53
152
原创 递归函数中的变量调用分析
分析递归函数中的变量调用问题对于我们理解递归函数的执行轨迹和编写递归类程序有着极大的帮助,下面我们就以一个具体的例子来分析所要描述的问题。 我们以马周游问题为例进行分析: 一、马周游问题描述在一个5 * 6的棋盘中的某个位置有一只马,如果它走29步正好经过除起点外的其他位置各一次,这样一种走法则称马的周游路线,试设计一个算法,从给定的起点出发,找出它的一条周游路线。为了便于
2013-06-05 23:17:14
345
原创 插入排序
#include;using namespace std;void insertSort(int a[],int begin,int end){ for(int i=begin+1;ia[i]) { break; }else { j++; } } if(jj;k--) { a[k]=a[k-1]; } a[j]=tmp; } }}int main(){ int a[10]={5,4,6,7,1
2013-06-05 23:08:34
131
原创 快速排序
#includeusing namespace std;void swap(int &a,int &b){ int tmp=a; a=b; b=tmp; return ;}void quickSort(int a[],int i,int j){ if(i>=j) { return ; }else { int tmp=a[i]; int m=i+1; i
2013-06-05 20:41:14
199
原创 堆排序
#includeusing namespace std;void swap(int a[],int i,int j){ int tmp=a[i]; a[i]=a[j]; a[j]=tmp; return ;}int Left(int a[],int p){ return p*2;}int Right(int a[],int p){ return p*2+1;}
2013-06-05 20:35:24
204
原创 中缀表达式转换为前缀表达式
#include#include#include#includeusing namespace std;stackopt;stacksubexp;string InfixToPrefix(string exp,int len){for(int i=len-1;i>=0;i--){if(exp[i]>='0'&&exp[i]<='9'){subexp.push(exp[i]);}else{if(ex
2013-06-05 20:33:01
162
原创 中缀表达式转换为后缀表达式
#include#include#include#includeusing namespace std;stackopt;stacksubexp;string InfixToPrefix(string exp,int len){ for(int i=len-1;i>=0;i--) { if(exp[i]>='0'&&exp[i]<='9') { subexp.
2013-06-05 20:29:50
136
原创 中缀表达式转换为前缀表达式
#include#include#include#includeusing namespace std;stackopt;stacksubexp;string InfixToPrefix(string exp,int len){ for(int i=len-1;i>=0;i--) { if(exp[i]>='0'&&exp[i]<='9') { subexp.
2013-06-05 20:25:43
146
原创 中缀表达式转换为前缀表达式
#include#include#include#includeusing namespace std;stackopt;stacksubexp;string InfixToPrefix(string exp,int len){ for(int i=len-1;i>=0;i--) { if(exp[i]>='0'&&exp[i]<='9') { subexp.
2013-06-05 20:23:18
150
原创 中缀表达式转换为前缀表达式
#include#include#include#includeusing namespace std;stackopt;stacksubexp;string InfixToPrefix(string exp,int len){for(int i=len-1;i>=0;i--){if(exp[i]>='0'&&exp[i]<='9'){subexp.push(exp[i]);}else{if(ex
2013-06-05 20:21:11
203
原创 递归函数中的变量调用分析
递归函数中的变量调用分析 分析递归函数中的变量调用问题对于我们理解递归函数的执行轨迹和编写递归类程序有着极大的帮助,下面我们就以一个具体的例子来分析所要描述的问题。我们以马周游问题为例进行分析: 一、马周游问题描述在一个5 * 6的棋盘中的某个位置有一只马,如果它走29步正好经过除起点外的其他位置各一次,这样一种走法则称马的周游路线,试设计一个算法,从给定的起点出发
2012-12-15 13:16:33
491
转载 递归详解
递归详解计算机科学的新学生通常难以理解递归程序设计的概念。递归思想之所以困难,原因在于它非常像是循环推理(circular reasoning)。它也不是一个直观的过程;当我们指挥别人做事的时候,我们极少会递归地指挥他们。对刚开始接触计算机编程的人而言,这里有递归的一个简单定义:当函数直接或者间接调用自己时,则发生了递归。递归的经典示例计算阶乘是递归程序设计的一个经典示例。计算某个
2012-12-13 13:40:52
280
原创 Hanoi Tower Sequence
Hanoi Tower Sequence一、问题描述DescriptionHanoi Tower is a famous game invented by the French mathematician Edourard Lucas in 1883. We are given a tower of n disks, initially stacked in decreasin
2012-10-23 18:08:26
729
转载 创意网站
创意网站以下给出的网站都很有创意,很好玩,大家可以进去看看http://www.cesmes.fi/pallo.swfhttp://thisissand.com/
2012-09-26 16:24:45
205
转载 全排列递归算法实现
全排列递归算法一、题目:用C++写一个函数, 如 Foo(const char *str), 打印出 str 的全排列(注意:输入的字符串可能有重复字符),如 abc 的全排列: abc, acb, bca, dac, cab, cba二、关于字符串全排列的理解字符串abc的全排列结果为:abcacbbacbcacbacab字符串abb的全排列为:a
2012-09-25 09:27:06
728
转载 整数划分问题
整数划分递归算法一、问题描述 将正整数n表示成一系列正整数之和:n=n1+n2+…+nk,其中n1≥n2≥…≥nk≥1,k≥1。正整数n的这种表示称为正整数n的划分。求正整数n的不同划分个数。例如正整数6有如下11种不同的划分,6;5+1;4+2,4+1+1;3+3,3+2+1,3+1+1+1;2+2+2,2+2+1+1,2+1+1+1
2012-09-24 19:28:51
153
转载 JDK环境变量配置
JDK环境变量配置进行java开发,首先要安装jdk,安装了jdk后还要进行环境变量配置:1、下载jdk2、安装jdk3、配置环境变量:右击“我的电脑”-->"高级"-->"环境变量"1)在系统变量里新建JAVA_HOME变量,变量值为:C:\Program Files\Java\jdk1.6.0_14(根据自己的安装路径填写)建议:JAVA_HOME变量值最好不要含有空格
2012-09-21 19:27:27
179
转载 VC 得到本地IP的方法
VC得到本地IP的方法今天写程序,需要得到本地IP地址,百度了一些方法。觉得下面的方法比较简单,所以就贴出来。以方便自己以后编程使用。char name[32]; memset(name,0,32); ::gethostname(name,sizeof(name)); hostent* host = ::gethostbyname(name);
2010-04-28 01:22:00
368
1
转载 CListCtrl控件中InsertItem和SettItemtext函数的用法简介
CListCtrl控件中InsertItem和SettItemtext函数的用法简介本人初次用CListCtrl控件的时候,对于 InsertItem和SetrtItemtext两个函数的作用始终不是太懂,比如如果不先调用InsertItem这个函数,后面的InsertItemtext函数写了,也不起作用.查了MSDN,也没有收获,经过有人点拔,才恍然大悟.今天将经验说一下,希望有共同爱好
2010-04-14 20:35:00
403
转载 VC中ListCtrl经验总结
VC中ListCtrl经验总结ListCtrl在工作中,常常用到,也常常看到大家发帖问怎么用这个控件,故总结了一下自己的使用经验,以供参考使用。先注明一下,这里,我们用m_listctrl来表示一个CListCtrl的类对象,然后这里我们的ListCtrl都是report形式,至于其他的如什么大图标,小图标的暂时不讲,毕竟report是大众话的使用。其次,我们这里用条款一,条款二来
2010-04-14 19:40:00
174
转载 VC中的Format的用法
VC中的Format的用法Format是一个很常用,却又似乎很烦的方法,本人试图对这个方法的帮助进行一些翻译,让它有一个完整的概貌,以供大家查询之用:首先看它的声明: function Format(const Format: string; const Args: array of const): string; overload;事实上Format方法有两个种形
2010-04-14 16:37:00
369
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人