一,什么是jsonjson是一种数据结构,易于人阅读和编写,同时也易于机器解析和生成。json建构两种结构:1,“名称/值”成对的集合,不同的语言中,它被理解为对象(object),纪录(record),结构(struct),字典(dictionary),哈希表(hash table),有键列表(k...
分类:
Web程序 时间:
2014-09-02 17:29:35
阅读次数:
180
简单的矩阵构造题,参看我前几篇的谈到的矩阵的构造法。#include #include #include #include using namespace std;int Mod;struct Matrax { int m[15][15];};Matrax a,per;int ats[15],an[...
分类:
其他好文 时间:
2014-09-02 17:24:34
阅读次数:
208
//链栈的实现 --大话数据结构99页#include using namespace std;//链节点定义typedef struct stacknode{ int data; struct stacknode * next;}StackNode, *LinkStackptr;//...
分类:
其他好文 时间:
2014-09-02 17:14:35
阅读次数:
262
1.深入内存对齐
为什么需要内存对齐呢?我们定义一个变量后,就会为该变量在某内存地址处分配一个空间。举例如下:
struct A
{
int d;
char c;
long l;
}
A a={0};//定义一个变量a.
设a 的地址为0,则a.d地址为0,a.c为4,a.l为5。如果空间真的是这样分配的话,会造成一个问题,在X86体系机器上,CPU的一次访存是直接取出3...
分类:
其他好文 时间:
2014-09-02 15:51:45
阅读次数:
253
昨天晚上在解决通过socket发送结构体的问题的时候,知道了可以将结构体先转化成字符串的形式再发送,但今天之前一直有个疑问没有解决(为了方便描述,去掉socket部分),首先看下代码:
#include
#include
#include
typedef struct info
{
char name[5];
char num[10];
}INFO;
int main()
{
I...
分类:
其他好文 时间:
2014-09-02 14:18:04
阅读次数:
172
1.冒号(:)用法(1)表示机构内位域的定义(即该变量占几个bit空间)typedef struct _XXX{unsigned char a:4;unsigned char c;} ; XXX(2)构造函数后面的冒号起分割作用,是类给成员变量赋值的方法,初始化列表,更适用于成员变量的常量const...
分类:
编程语言 时间:
2014-09-02 14:08:06
阅读次数:
286
呃,离散数学课上直接就有这样的题#include #include #include using namespace std;const int Mod=1000;struct Matrax { int m[25][25];};Matrax a,per;int n,m;void initial(){...
分类:
其他好文 时间:
2014-09-02 14:03:14
阅读次数:
206
union myun{struct { int x; int y; int z; }u;int k;}a;int main(){a.u.x =4;a.u.y =5;a.u.z =6;a.k = 0;printf("%d %d %d\n",a.u.x,a.u.y,a.u.z);return 0;//输...
分类:
编程语言 时间:
2014-09-02 13:51:44
阅读次数:
189
stdio.h 头文件中,有以下内容(用内部行号解释): 1 /* The opaque type of streams. This is the definition used elsewhere. */ 2 46 typedef struct _IO_FILE FILE; 3 ... ...
分类:
系统相关 时间:
2014-09-02 12:15:24
阅读次数:
280
#include
struct a{
char x[6];
int y;
char z[6];
};
struct b{
int y;
char x[6];
char z[6];
};
union c{
char x[6];
int y;
char z[6];
};
int main()
{
printf("%d,%d,%d\n",sizeof(struct a),sizeof...
分类:
其他好文 时间:
2014-09-01 22:50:33
阅读次数:
260