C语言 结构体问题!急~!!
来源:百度知道 编辑:UC知道 时间:2024/06/07 09:10:29
这个程序有问题 请问是咋回事儿?而且麻烦结构体部分给一下解释...实在不懂.........
#include <iostream.h> //
#include "stdio.h"
#include "stdlib.h"
int s = 81; //initialize s,t,u
int t = 4;
float u = 1.5;
struct node //define a node
{
float data;
struct node* up;
struct node* down;
};
struct node *Head = NULL;
struct node* getnode(int x,int y) //return this function is the type of node*
{
int up = 0; //count the up times,initialize up and down
int down = 0;
int i,j;
struct node* temp = Head; //define a null index temp
// temp = Head;
down = y;
up = x-y;
for(i=0;i<up;i++)
{
//temp->up = temp;
#include <iostream.h> //
#include "stdio.h"
#include "stdlib.h"
int s = 81; //initialize s,t,u
int t = 4;
float u = 1.5;
struct node //define a node
{
float data;
struct node* up;
struct node* down;
};
struct node *Head = NULL;
struct node* getnode(int x,int y) //return this function is the type of node*
{
int up = 0; //count the up times,initialize up and down
int down = 0;
int i,j;
struct node* temp = Head; //define a null index temp
// temp = Head;
down = y;
up = x-y;
for(i=0;i<up;i++)
{
//temp->up = temp;
#include <iostream.h> //
#include "stdio.h"
#include "stdlib.h"
int s = 81; //initialize s,t,u
int t = 4;
float u = 1.5;
struct node //define a node
{
float data;
struct node* up;
struct node* down;
}; //定义了一个node结构,包含三个变量 float型的 data
//指向node结构本身的指针 up 和 down (这个结构用作树的节点 )
struct node *Head = NULL; //树的指针
struct node* getnode(int x,int y) //return this function is the type of node*
{
int up = 0; //count the up times,initialize up and down
int down = 0;
int i,j;
struct node* temp = Head; //define a null index temp
// temp = Head;
down = y;
up = x-y;
for(i=0;i<up;i++)
{
//temp->up = temp;
temp = temp->up;
}
for(j=0;j<down;j++)
{
temp = temp->down;
}
return temp;
}
//build a tre