算法代码
文章平均质量分 57
bedynamic
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
公司员工信息管理代码
文件cpp.cpp #include"cpp3.h" Staff::Staff() { name[0]='0'; no[0]='0'; department[0]='0'; money=0; work[0]='0'; } Staff::Staff(char *name1,char*no1,char*dep1,int money1,char *work1)原创 2013-03-09 18:15:31 · 555 阅读 · 0 评论 -
简单的快速排序
#include void exchange(int &i,int &j) { int temp; temp=i; i=j; j=temp; } int partition(int a[],int p,int r) { int x; x=a[r]; int i=p-1; for(int j=p;j<r;j++) { if(a[j]<=x) { i=i+1;原创 2013-09-23 19:33:38 · 424 阅读 · 0 评论 -
堆排序
#include using namespace std; // 输出当前堆的排序状况 void PrintArray(int data[], int size) { for (int i=1; i cout cout } // 堆化,保持堆的性质 // MaxHeapify让a[i]在最大堆中"下降", // 使以i为根的子原创 2013-09-18 21:32:22 · 382 阅读 · 0 评论 -
排序算法实现
#include void main() { int a[]={5,2,4,6,1,3}; //int temp; /* 第一种 for(int j=1;j<sizeof(a)/sizeof(a[0]);j++) { for(int i=0;i<(sizeof(a)/sizeof(a[0])-1);i++) { if(a[i]>a[i+1]) { t原创 2013-09-17 16:57:31 · 382 阅读 · 0 评论 -
八枚银币(以最少称次数找出其中假币)
有八枚银币a b c d e f g h ,已知其中一枚是假币,其重量不同于真币,但不知是较重还是较轻,如何便宜用天平以最少的比较次数决定出那个是假币。并得知假币比真币较轻 #include #include #include void compare(int[],int ,int ,int); void eightcoins(int[]); int main(void) { i原创 2013-09-17 18:17:36 · 344 阅读 · 0 评论 -
骑士走棋盘
#include #include #define SIZE 8 using namespace std; bool travel(int board[][SIZE],int x,int y); int possible(int board[][SIZE],int *nexti,int *nextj,int x,int y); int min原创 2013-08-09 09:54:53 · 504 阅读 · 0 评论 -
河内之塔求解
如果柱子标为ABC,要由A搬至C,在只有一个盘子时,就将它直接搬至C,当有两具盘子时,就将B当作辅助柱。如果盘子数超过2,将第三个以下遮起来。即每次处理两个盘子。A->B,A->C,B->C. #include using namespace std; void hanoi(int n,char A,char B,char C) { if(n==1) cout else{ hano原创 2013-08-04 16:55:36 · 319 阅读 · 0 评论 -
巴斯卡三角
#include using namespace std; #define N 12 double combi(int n,int r) { int i; double p=1; for(i=1;i p=p*(n-i+1)/i; return p; } int main() { int n, r, t; for(n=0;n { for(r=0;r { if(r=原创 2013-08-04 17:32:01 · 435 阅读 · 0 评论 -
一个小小的windows应用程序
#include #include LRESULT CALLBACK WinSunProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam //2013-05-17 21:46:06 · 120 阅读 · 0 评论 -
设计异质链表实现学校人员的信息管理
#include #include #include enum node_type{student,professor,staff};//枚举三种结点类型 //结构体,表示学生的特殊信息 struct student_type { float average; int grade; }; class node { friend class list;原创 2013-03-30 09:03:57 · 390 阅读 · 0 评论 -
使用类的继承和派生设计公司职员的信息管理
Manager.cpp文件 #include #include"employee.h" int main() { manager m1; technician t1; salesmanager sm1; salesman s1; techmanager tm1; m1.prompt(4); m1.pay(); m1.displaySt原创 2013-03-21 21:47:40 · 543 阅读 · 0 评论 -
大整数乘法。
#include using namespace std; int *multi(int *num1,int size1,int*num2,int size2) { int size =size1+size2; int *ret=new int [size]; int i=0; for(i=0;i { ret[i]=0; }原创 2013-03-09 12:43:22 · 345 阅读 · 0 评论 -
NSBundle介绍
bundle是一个目录,其中包含了程序会使用到的资源. 这些资源包含了如图像,声音,编译好的代码,nib文件(用户也会把bundle称为plug-in). 对应bundle,cocoa提供了类NSBundle. 我们的程序是一个bundle. 在Finder中,一个应用程序看上去和其他文件没有什么区别. 但是实际上它是一个包含了nib文件,编译代码,以及其他资源的目录. 我们把这个目录叫做程转载 2014-09-02 09:54:15 · 357 阅读 · 0 评论
分享