Thread View: cn.bbs.comp.program
1 messages
1 total messages
Started by ��������ѩ
Thu, 28 May 1998 00:00
Re: Ī������Ĵ���!
Author: ��������ѩ
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]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads