#includevoid main(){const int count = 5;//定义数量struct student{char name[80];float math,eng;float aver;}stu[count],temp;//输入for (int i = 0; i stu[sub].a...
分类:
编程语言 时间:
2014-07-01 13:32:56
阅读次数:
257
【c# vs c++】1、在 C++ 中,类和结构实际上是相同的,而在 C# 中,它们很不一样。C# 类可以实现任意数量的接口,但只能从一个基类继承。而且,C# Struct不支持继承,也不支持显式默认构造函数(必须提供参数化构造函数)。 1)It is an error to define a ....
分类:
编程语言 时间:
2014-07-01 12:22:53
阅读次数:
260
链表节点定义如下:1 typedef struct ListNode2 {3 int value;4 ListNode *next;5 }TListNode;众所周知,链表打印时从头到尾很简单,所以我们首先想到的可能是先把链表逆序,然后从头到尾再打印出来即可,但是逆序会破坏链表的结构...
分类:
其他好文 时间:
2014-07-01 11:54:59
阅读次数:
168
OVS中流表操作的理解关键在于这里哈希表的实现,引入的 flex_array方便了内存的管理,通过 hash&(桶数-1)可以随机的将一个元素定位到某一个桶中。
接下来是代码细节。
一. 核心数据结构
//流表
struct flow_table
{
struct flex_array
* buckets; //具体的流表项
unsigned...
分类:
其他好文 时间:
2014-07-01 11:09:12
阅读次数:
638
题目描述:
输入一个链表的头结点,从尾到头反过来打印出每个结点的值。链表结点定义如下:
struct ListNode{
int
m_nKey;
ListNode *m_pNext;
};
分析描述:
对于链表,如果是从头到尾的打印出链表是比较容易,但如果是从尾到头返过来打印每个结点的值就比较复杂。反序输出就是第一个遍历到的结点最后一个输出,而最后一个遍历的结点第一个输出。...
分类:
其他好文 时间:
2014-07-01 10:59:13
阅读次数:
163
下面这个散列表的实现来自K&R,很经典。在其他场景中遇到的实现更复杂,基本原理不变,只是在hash算法,或者在快速查询上做了优化。
#include
#include
//具有相同hash值构成的链表
struct nlist{
struct nlist
* next;
char * name; //key-定义的名字
char ...
分类:
其他好文 时间:
2014-07-01 07:42:51
阅读次数:
158
#include
#include
#define MAX_MSG_BUF_LEN 512
int iKey = 6004;
struct ipcmsgbuf
{
long mtype;
char mtext[MAX_MSG_BUF_LEN];
};
int main( void )
{
int qid;
cha...
分类:
其他好文 时间:
2014-07-01 06:50:31
阅读次数:
199
Stage II过程分析
在Stage II中使用到了一些比较重要的数据结构,这里先对这些数据结构来进行下分析:
typedef struct global_data {
bd_t *bd;
unsigned long flags;
unsigned long baudrate;
unsigned long have_console; /* serial_init() was cal...
分类:
其他好文 时间:
2014-07-01 06:16:16
阅读次数:
371
直接上代码
/*
* bst.h
*
* Created on: Jun 20, 2014
* Author: buyuanyuan
*/
#ifndef BST_H_
#define BST_H_
#include
#include
typedef enum Color {
RED = 0,
BLACK = 1
} Color;
typede...
分类:
其他好文 时间:
2014-07-01 06:11:04
阅读次数:
224
#include#include#include#includeusing namespace std;typedef long long ll;ll n,p;ll k;#define N 4000000ll a[N],fr[N];struct sq{ ll a[3][3]; sq(){...
分类:
其他好文 时间:
2014-07-01 00:44:52
阅读次数:
308