11 2017 档案

摘要:这里要写到的插入排序算法和之前使用的选择排序算法很像,但是插入排序算法的效率比之要高,因为与选择排序算法不同的是,排序的同时一旦找到比前面的小,后面的大马上终止遍历。但下面这段插入排序算法经程序验证之后,耗费时间较之选择排序算法要长,是因为找到合适的位置时需要swap函数置换一下位置,但swap函数 阅读全文
posted @ 2017-11-30 22:27 boht 阅读(147) 评论(0) 推荐(0)
摘要:#pragma once#include <iostream>using namespace std;#include <ctime>#include <assert.h> 随机生成算法中特殊需要说明的几个方面就是 srand(time(NULL))时间种子(暂时对时间种子疑问)。2:声明的区间表示 阅读全文
posted @ 2017-11-28 22:57 boht 阅读(281) 评论(0) 推荐(0)
摘要:// wanmeilifang.cpp: 定义控制台应用程序的入口点。// #include "stdafx.h"#include <iostream>#include <algorithm>using namespace std; void selectmin(int arr[], int n){ 阅读全文
posted @ 2017-11-27 22:46 boht 阅读(139) 评论(0) 推荐(0)
摘要:// wanmeilifang.cpp: 定义控制台应用程序的入口点。// #include "stdafx.h"#include <iostream>using namespace std; 采用的是枚举法,四重循环int main(){ int N; cout << "请输入一个小于365的数: 阅读全文
posted @ 2017-11-27 00:33 boht 阅读(591) 评论(0) 推荐(0)
摘要:对象成员指针实例化时,先调用嵌套构造函数,在构造line函数。 销毁对象时,先销毁嵌套构造函数coordinate,在销毁line函数,这个和嵌套对象成员函数不一样。 coordinate.h #pragma onceclass coordinate{public: coordinate(int x 阅读全文
posted @ 2017-11-23 23:14 boht 阅读(142) 评论(0) 推荐(0)
摘要:.h 文件 #pragma onceclass coordinate{public: coordinate(); ~coordinate();public: int m_ix; int m_iy; }; .cpp 文件 #include "stdafx.h"#include "coordinate. 阅读全文
posted @ 2017-11-23 21:37 boht 阅读(130) 评论(0) 推荐(0)
摘要:.h 文件 #pragma onceclass Array{public: Array(int count); Array(const Array &arr); ~Array(); void setcount(int count); int getcount(); void printAddr(); 阅读全文
posted @ 2017-11-22 23:35 boht 阅读(174) 评论(0) 推荐(0)
摘要:.h 文件 #pragma onceclass Array{public: Array(); Array(const Array &arr); ~Array(); void setcount(int count); int getcount(); private: int m_iCount;}; . 阅读全文
posted @ 2017-11-21 22:19 boht 阅读(384) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include <vector>#include <iostream>using namespace std; int main(){ vector<int> ivec; int ival; cout << "enter number(ctrl+z to en 阅读全文
posted @ 2017-11-20 23:06 boht 阅读(1163) 评论(0) 推荐(0)