为什么会有错?error C2059: 语法错误 : “{”,error C2143: 语法错误 : 缺少“;”(在“{”的前面 5
typedefstruct{intweight;intparent,lchild,rchild;}HTNode,*HuffmanTree;voidmain(){HTNod...
typedef struct{
int weight;
int parent,lchild,rchild;
}HTNode,*HuffmanTree;
void main()
{
HTNode *p;
*p={0,0,0,0};
cout<<p->weight<<" "<<p->parent<<" "<<p->lchild<<" "<<p->rchild<<endl;
}
出错位置为:*p={0,0,0,0}; 展开
int weight;
int parent,lchild,rchild;
}HTNode,*HuffmanTree;
void main()
{
HTNode *p;
*p={0,0,0,0};
cout<<p->weight<<" "<<p->parent<<" "<<p->lchild<<" "<<p->rchild<<endl;
}
出错位置为:*p={0,0,0,0}; 展开
3个回答
展开全部
#include<iostream>
using namespace std;
typedef struct{
int weight;
int parent,lchild,rchild;
}HTNode,*HuffmanTree;
void main()
{
HTNode *p=new HTNode; //这里要先分配内存
//蔽春衫*p={0,0,0,0}; //这样的赋值只能在定义的时候进宏腔行,比如 HTNode pp={0,0,0,0};
//注意.的优先级比*高
(*p).weight=0;
(*p).lchild=0;
(*p).parent=0;
(*p).rchild=0;
cout<<p->weight<<" "<<p->parent<<" "<<p->lchild<<" "<森渣<p->rchild<<endl;
}
using namespace std;
typedef struct{
int weight;
int parent,lchild,rchild;
}HTNode,*HuffmanTree;
void main()
{
HTNode *p=new HTNode; //这里要先分配内存
//蔽春衫*p={0,0,0,0}; //这样的赋值只能在定义的时候进宏腔行,比如 HTNode pp={0,0,0,0};
//注意.的优先级比*高
(*p).weight=0;
(*p).lchild=0;
(*p).parent=0;
(*p).rchild=0;
cout<<p->weight<<" "<<p->parent<<" "<<p->lchild<<" "<森渣<p->rchild<<endl;
}
2011-10-30
展开全部
#include<iostream.h>
typedef struct{
int weight;
int parent,lchild,rchild;
}HTNode,*HuffmanTree;
void main()
{
HTNode a[4]={0,0,0,0};
HTNode *p;
p=a;
cout<<p->weight<<"仔毕枝 "数禅<<p->parent<<" "<<p->lchild<<" "<<p->rchild<<endl;
}指针P的念敏初始化错了;
typedef struct{
int weight;
int parent,lchild,rchild;
}HTNode,*HuffmanTree;
void main()
{
HTNode a[4]={0,0,0,0};
HTNode *p;
p=a;
cout<<p->weight<<"仔毕枝 "数禅<<p->parent<<" "<<p->lchild<<" "<<p->rchild<<endl;
}指针P的念敏初始化错了;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include<iostream>宏腔
using namespace std;
typedef struct
{
int weight;
int parent,lchild,rchild;
}HTNode,*HuffmanTree;
void main()
{
HTNode *p;
HTNode human;
p=&human;
p->weight=0;
p->parent=0;
p->lchild=0;
p->rchild=0;
cout<<p->weight<<"森渣 "<<p->parent<<" "<<p->lchild<<" "<<p->rchild<<蔽春衫endl;
}
using namespace std;
typedef struct
{
int weight;
int parent,lchild,rchild;
}HTNode,*HuffmanTree;
void main()
{
HTNode *p;
HTNode human;
p=&human;
p->weight=0;
p->parent=0;
p->lchild=0;
p->rchild=0;
cout<<p->weight<<"森渣 "<<p->parent<<" "<<p->lchild<<" "<<p->rchild<<蔽春衫endl;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询