码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
排序之直接插入排序法
最近看数据结构时看到直接插入排序法,其基本思想是:将一个记录插入到已经排好序的有序表中,从而得到一个新的,记录数增1的有序表下面是代码实现与测试 1 #include 2 using namespace std; 3 void InsertSort(int *q,int L) 4 { 5 ...
分类:其他好文   时间:2014-05-24 07:07:19    阅读次数:285
获得第二大的元素
#includeusing namespace std;int main(){ int s1 = 1; unsigned int s2 = 1; cout>和逻辑右移(不带符号)>>>。 //算术右移:符号位不变,左边补上符号位。如: 1000 1000 >> 3 为 1111 0001 //逻辑右...
分类:其他好文   时间:2014-05-24 06:45:46    阅读次数:280
计算出前N项的数据
#include#include#includeusing namespace std;const int N = 10;int helper(int* a,const int num1,const int num2){ int i=1; int j=1; for(int m = 0;m te...
分类:其他好文   时间:2014-05-24 06:17:01    阅读次数:222
归并排序
归并排序#define LOCAL#include#include //生成随机数c++11支持 #include #include #includeusing namespace std;int const MAX_N=10;int a[MAX_N],b[MAX_N],c[2*MAX_N];//归...
分类:其他好文   时间:2014-05-24 06:01:45    阅读次数:354
c++ stl algorithm: std::fill, std::fill_n
std::fill 在[first, last)范围内填充值#include #include #include int main(){ std::vector v; v.resize(10); std::fill(v.begin(), v.end(), 100); retu...
分类:编程语言   时间:2014-05-24 05:15:36    阅读次数:320
将后面的m个数移到前面
#include#include#include#includeusing namespace std;int bigswap(char* a,int start,int end){ while(start<end) { swap(a[start],a[end]); ...
分类:其他好文   时间:2014-05-24 04:53:54    阅读次数:208
c++11
devcpp增加对c++11的支持工具→编译选项如图,增加c++11支持c++11 random头文件对随机数的支持// random_device example#include #include int main (){ std::random_device rd; std::cout #i.....
分类:编程语言   时间:2014-05-24 04:52:52    阅读次数:311
poj2109(Power of Cryptography)
神水。求n=log(k p)-> k=pow(p,1/n)。G++和C++输出不同,编译器原因。代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 int main()10.....
分类:其他好文   时间:2014-05-23 23:31:42    阅读次数:237
命名管道-简单的例子
#include "stdafx.h"#include#include#includeusing namespace std;DWORD WINAPI thread1(LPVOID param){ char buf[256]; DWORD rlen=0; HANDLE hPipe ...
分类:其他好文   时间:2014-05-23 23:13:19    阅读次数:304
找到链表的倒数第K位
#includeusing namespace std;class node{public: node():value(0),next(NULL){} ~node(){} int value; node* next;};///be careful this ;node* cr...
分类:其他好文   时间:2014-05-23 23:06:05    阅读次数:258
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!