码迷,mamicode.com
首页 >  
搜索关键字:namespace    ( 41927个结果
十进制转换为八进制 -- 蓝桥杯(两种方法)
编写函数,其功能为把一个十进制数转换为其对应的八进制数。程序读入一个十进制数,调用该函数实现数制转换后,输出对应的八进制数。 样例输入 9274 样例输出 22072 样例输入 18 样例输出 22 代码一; #include #include using namespace std; int main() { ...
分类:其他好文   时间:2015-04-09 17:35:01    阅读次数:137
两种快速排序算法性能的比较
先来看看第一种快速排序算法(QuickSort1): #include #include #include #define MAXNUM 1024 using namespace std; void QuickSort(int A[], int low, int high) { if(low>=high) return; int first = low; int last ...
分类:编程语言   时间:2015-04-09 17:30:15    阅读次数:189
C++ lambda表达式复习
#include #include #include #include using namespace std; int main() { //最简单的lambda表达式 [](){}; //lambda表达式也就是一个函数,我们可以把它赋给函数指针,也可以在后面加上括号使用。 // //[]里面可以添加一些限制lambda块语句中使用外部变量的限制符。一共有四种情况...
分类:编程语言   时间:2015-04-09 17:24:20    阅读次数:142
[c++]容器类
#include #include using namespace std; class string1 { private: char *str; public: string1(const char *s) { str = new char[strlen(s) + 1]; strcpy(str,s); cout<<"str...
分类:编程语言   时间:2015-04-09 17:23:38    阅读次数:132
蓝桥杯 历届试题 城市建设 最小生成树
把码头作为0点处理。 首先判断不建码头是否可以生成最小生成树 最小生成树用kruskal算法,若对于代价 若可以:Min(最小生成树(不建码头),最小生成树(建码头)); 若不可:最小生成树(建码头) #include "stdio.h" #include "string.h" #include "algorithm" using namespace std; int fathe...
分类:其他好文   时间:2015-04-09 17:22:59    阅读次数:180
C++单链表对环的操作。
#include using namespace std; template class Node { public: Node(_Ty _X=_Ty()):_Data(_X),_Next(NULL){} int _Data; Node *_Next; }; template class List { public: List() { _First = new Node()...
分类:编程语言   时间:2015-04-09 15:34:13    阅读次数:130
第六周 项目一-深复制体验(1)
#include #include using namespace std; class A { private: char *a; public: A(char *aa) { a = new char[strlen(aa)+1]; //(a)这样处理的意义在于:为aa指针开辟出空间 strcpy(a, aa); /...
分类:其他好文   时间:2015-04-09 15:30:44    阅读次数:109
蓝桥杯 - 安慰奶牛 (最小生成树)
题目传送:蓝桥杯 - 安慰奶牛 思路:先算好边的权值,为本来的边的权值的两倍加上两个点的权值,再进行kruskal,因为边数较大,不宜采用prim AC代码: #include #include #include #include using namespace std; #define LL long long #define INF 0x7ff...
分类:其他好文   时间:2015-04-09 15:29:09    阅读次数:146
C++反汇编学习笔记(六)各种算术运算的工作形式(1)
1、 加法 加法的几种情况: ① 常量+常量 ② 变量+常量 ③ 变量+变量DebugRelease#include using namespace std;int main(){...........//保存现场和初始化略 int a=0, b=0;008544FE mov d...
分类:编程语言   时间:2015-04-09 15:15:59    阅读次数:214
C++之虚函数和虚继承
首先来看一个实例 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 class A 7 { 8 public: 9 A(){ cout fun();42 a->V_fun();43 a...
分类:编程语言   时间:2015-04-09 15:01:06    阅读次数:148
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!