Article View: cn.bbs.comp.program
Article #762Re: Ī������Ĵ���!
From: ��������ѩ
Date: Thu, 28 May 1998 00:00
Date: Thu, 28 May 1998 00:00
52 lines
1696 bytes
1696 bytes
> [1;36m==> Rong_Jiang(Carino) ˵��: [37;40m[0m
> source code :
> #include <iostream.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <conio.h>
> #define Max 40
> #define Huge 32676
> //data structure
> struct node
> {
> int weight;
> int parent,lch,rch;
> char info;
> };
> typedef struct node Node;
> struct code
> {
> char bits[Max];
> int start;
> };
> typedef struct code Code;
> //global variables
> Node *ht[2*Max];
^^^^^^^^^^
���ָ������û�б���ʼ����ʹ���ˣ���Ȼ��������
> int n;
> void main()
> {
> int i;
> cout<<"Please input the number of the nodes:"<<endl;
> cin>>n;cout<<endl;
> for(i=0;i<n;i++)
> {
> ht[i]->weight=Huge;ht[i]->parent=ht[i]->lch=ht[i]->rch=NULL;
> ht[i]->info= ' ';
> }
> cout<<"Now input each node's info and weight:"<<endl;
> for(i=0;i<n;i++)
> {
> cin>>ht[i]->info>>ht[i]->weight;
> cout<<"Now you have input "<<ht[i]->info<<" and "<<ht[i]->weight<<endl;
> cout<<ht[i]->info<<" "<<ht[i]->weight<<endl;
> }
> cout<<endl;
> for(i=0;i<n;i++) cout<<ht[i]->info<<" "<<ht[i]->weight<<endl;
> }
>
--
�� ��Դ: �й�ƴ�BBSվ [bbs.ustc.edu.cn]
Technical Details
Message-ID:
<980528.yf1sI$PBBS@bbs.ustc.edu.cn>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: fc86e,ee0256fdea0eacf9,start X-Google-Attributes: gidfc86e,public From: Jiang_Liguo@bbs.ustc.edu.cn (��������ѩ) Subject: Re: Ī������Ĵ���! Date: 1998/05/28 Message-ID: <980528.yf1sI$PBBS@bbs.ustc.edu.cn> X-Deja-AN: 357449601 Organization: �й�ƴ�BBSվ Newsgroups: cn.bbs.comp.program