码迷,mamicode.com
首页 >  
搜索关键字:struct enum    ( 22969个结果
009实现一个算法来删除单链表中的一个结点,只给出指向那个结点的指针(keep it up)
呵呵,这个题不能直接删除已知的结点,因为是单链表,不知道前驱,只知道 后继结点,直接删除会使链表断开。不过我们可以删除已知结点的后继结点, 把后继结点的值赋值给已知结点。 #include struct Node { int data; Node* next; }; bool removeNode(Node* vNode) { if (vNode == NULL || vNo...
分类:其他好文   时间:2014-08-20 01:25:45    阅读次数:174
Exercise DS
#include using namespace std;typedef struct Node{ Node *next; int data;}Node, *List;typedef struct DNode{ DNode *prior; DNode *next; in...
分类:其他好文   时间:2014-08-20 01:16:55    阅读次数:346
nyoj 12 喷水装置(二)【贪心】+【区间完全覆盖覆盖】
题意:。。。 这道题就是区间问题三种中的区间完全覆盖问题,不懂的可以看我上一篇也是区间完全覆盖。 直接上代码: #include #include #include using std::sort; struct node{ double le, ri; }s[1005]; int cmp(node a, node b) { return a.le < b.le; } int ma...
分类:其他好文   时间:2014-08-20 00:02:06    阅读次数:297
C++11 新特性(5) 统一初始化
在C++11之前,初始化的类型并非总是统一的。 例如以下两个man定义,一个作为结构,一个作为类。两者的初始化是不一样的。 #include using namespace std; struct manStruct{ string name; int age; }; class manClass { private: string name; int age; public: m...
分类:编程语言   时间:2014-08-19 22:34:35    阅读次数:240
C++时间戳转化(涉及GMT CST时区转化)
问题由来时间戳转换(时间戳:自 1970 年1月1日(00:00:00 )至当前时间的总秒数。)#include #include int main(int argc, const char * argv[]){ time_t t; struct tm *p; t=1408...
分类:编程语言   时间:2014-08-19 20:45:35    阅读次数:298
Trie树 模板
typedef struct node{ int count; struct node *next[MAX];}Trie;Trie *Newnode()//建立结点&初始化a{ int i; Trie *T; T = (Trie *)malloc(sizeof(Trie...
分类:其他好文   时间:2014-08-19 20:39:25    阅读次数:169
邻接表 - 边表
我对边表的理解和边表的建立://结构struct node{ int u,v,w; int next;}g[M];int head[N],t = 0;//初始化void init(){ t = 0; memset(head,-1,sizeof(head));}//加边void...
分类:其他好文   时间:2014-08-19 20:32:05    阅读次数:287
struct{0}二
一直以为 int a[256]={0};是把a的所有元素初始化为0,int a[256]={1};是把a所有的元素初始化为1.调试的时查看内存发现不是那么一回事,翻了一下《The C++ Programming Language》总算有定论。PDF的竟然不然复制,就把它这章翻译了,如下5.2.1 ....
分类:其他好文   时间:2014-08-19 20:30:35    阅读次数:262
ns3 常用优化技术
ns3中大部分程序使用C++,对C++的很多部分都进行了优化,比如日志系统/智能指针等. 于是就想起写这片文章来总结一下. 1. Logging系统 C++中一般使用std::cout来打印消息,当打印语句增多时,这个就不太实用了,于是出现了Logging系统,其实是对打印的消息进行了分类,从而更好的控制打印的消息.log的级别在程序中是这样设定的: enum LogLevel { LO...
分类:其他好文   时间:2014-08-19 19:13:25    阅读次数:371
【C++基础】类class
【意义】Class是一种类型type,定义类的格式与struct相似,但能在定义体内添加操作;【定义】class Date{ int year; //数据成员 int month; int day; public: //成员函数 void set(i...
分类:编程语言   时间:2014-08-19 18:41:25    阅读次数:422
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!