随笔分类 - C++
摘要:多线程编程出现的主要问题为:死锁(deadlock)、无限延迟(indefinite postponement)以及数据竞争(data race)。在面向对象应用程序中使用多线程最有效的途径就是通过构建于C++进程间通信组件(IPC)、C++同步组件以及C++互斥组件之上的应用框架。(application framework)。而构建IPC、同步和互斥组件的最有效途径就是构建接口类(interface class)和类库(class library),让他们封装提供线程和API任务的操作系统服务。常见的C++组件有4种:类(class)、集合和容器(collection and contai
阅读全文
摘要:#include<iostream>#include<stdlib.h>#include<string.h>using namespace std;typedef struct{ int weight; int parent,lchild,rchild; int asc;}HTNode,*HuffmanTree; //定义赫夫曼存储结构struct node{ int ASCII; int n;};struct node a[127];struct node w[127]; //一些全局变量int count;HTNode H_T[250];char...
阅读全文