请帮助一个功能 - 请 [英] help with a funcition-please

查看:67
本文介绍了请帮助一个功能 - 请的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我需要写一个名为install的函数,它需要作为参数

1- a vector

2-a number

3 - 一个名为next_level的列表


所以它会变得有点奇怪:


next_level是一个包含{vectors,with

指针},由以下结构定义

typedef struct wnode {

int weight [maxrank + 1];

struct wnode * next;

} WEIGHTPTR,* WEIGHTPTR;


现在install是一个返回指向frist向量的指针的函数

在列表中,任何人都可以给代码定义这个功能。?


谢谢:

解决方案

2006-06-05,natman< na ******* @ gmail.com>写道:

你好我需要写一个名为install的函数,它需要作为参数
Okey doke。

1- a vector


你需要一个结构(用于n维向量):


struct vector {

int direction [n];

int magnitude;

}

2-a number


int将起作用;长或短可能更合适,但我不能在没有更多信息的情况下知道


3 - 名为next_level


什么样的清单?所有编程教科书都有链接列表的代码;

我唯一可以从经验中推荐的是理查德释放的C

Heathfield,Lawrence Kirby和其他一些人。

所以它会变得有点奇怪:

next_level是一个包含{vectors,with
pointers}元素的列表,由以下struct
typedef struct wnode {
int weight [maxrank + 1];
struct wnode * next;
} WEIGHTPTR,* WEIGHTPTR;


我看到一个指针,但我不确定你是如何在

中代表一个向量的;我怀疑+1允许幅度,以及maxrank

指示。

现在安装是一个函数,返回指向frist矢量的指针
列表,任何人都可以给代码定义这个功能。?



Nope。当你有一个可编辑的例子时我们会帮助你,但是直到

然后我们不会为你做功课。不过我会给你一个提示:

双联系列表可以帮到你。


-

安德鲁Poelstra< http://www.wpsoftware.net/blog >

给我发电子邮件,请使用apoelstra。在上面的地址。

如果我们只是让偷猎者进入动物园,我们会给b
$ b更少的人和更多花式钢琴!


我的向量是通过
定义的。
int vector [n]


n昏暗的向量

Andrew Poelstra写道:

2006-06-05,natman< na ******* @ gmail.com>写道:

我需要写一个名为install的函数,它作为参数


Okey doke。

1- a vector



你需要一个结构(对于一个n维向量):

结构向量{
int direction [n];
int magnitude;
}

2-a number



int将起作用;长或短可能更合适,但我不能在没有更多信息的情况下知道。

3 - 名为next_level的列表


<什么样的清单?所有编程教科书都有链接列表的代码;
我可以从经验中推荐的唯一一个是理查德释放的理查德
希思菲尔德,劳伦斯柯比和其他一些人。


所以它会变得有点奇怪:

next_level是一个包含{vectors,with
pointers}元素的列表,由以下struct
typedef struct wnode {
int weight [maxrank + 1];
struct wnode * next;
} WEIGHTPTR,* WEIGHTPTR;


<我看到了一个指针,但我不确定你是如何在
中表示一个向量的;我怀疑+1允许幅度,以及maxrank
方向。

现在安装是一个函数,返回指向frist矢量的指针
列表,任何人都可以给代码定义这个功能。?


不。当你有一个可编辑的例子时,我们会帮助你,但是直到
然后我们就不会为你做功课了。不过,我会给你一个提示:
双链表可以帮到你。

-
Andrew Poelstra< http://www.wpsoftware.net/blog >
给我发电子邮件,使用apoelstra在上面的地址。
如果我们只是让偷猎者进入动物园,我们会有更少的被压扁的人和更多的花式钢琴!




好的,我有整个程序正常工作,但它是相当数量的代码,

有一些真正只能和人共处的东西,所以我会发布

我对定义安装函数的猜测

WEIGHTPTR install(int * v,int rank,WEIGHTPTR next_level){

++ next_level.next;

返回next_level;

}


请参阅上一篇文章defn of struct WEIGHTPTR,


Andrew Poelstra写道:

2006-06-05,natman< na ******* @ gmail.com>写道:

我需要写一个名为install的函数,它作为参数


Okey doke。

1- a vector



你需要一个结构(对于一个n维向量):

结构向量{
int direction [n];
int magnitude;
}

2-a number



int将起作用;长或短可能更合适,但我不能在没有更多信息的情况下知道。

3 - 名为next_level的列表


<什么样的清单?所有编程教科书都有链接列表的代码;
我可以从经验中推荐的唯一一个是理查德释放的理查德
希思菲尔德,劳伦斯柯比和其他一些人。


所以它会变得有点奇怪:

next_level是一个包含{vectors,with
pointers}元素的列表,由以下struct
typedef struct wnode {
int weight [maxrank + 1];
struct wnode * next;
} WEIGHTPTR,* WEIGHTPTR;


<我看到了一个指针,但我不确定你是如何在
中表示一个向量的;我怀疑+1允许幅度,以及maxrank
方向。

现在安装是一个函数,返回指向frist矢量的指针
列表,任何人都可以给代码定义这个功能。?


不。当你有一个可编辑的例子时,我们会帮助你,但是直到
然后我们就不会为你做功课了。不过,我会给你一个提示:
双链表可以帮到你。

-
Andrew Poelstra< http://www.wpsoftware.net/blog >
给我发电子邮件,使用apoelstra在上面的地址。
如果我们只是让偷猎者进入动物园,我们会有更少的被压扁的人和更多的花式钢琴!




Hi i need to write a funcition called install, its takes as arguments
1- a vector
2-a number
3-a list called next_level

so heres where it get kinda weird:

next_level is a list comprising of elements that are { vectors, with
pointers}, defined by the following struct

typedef struct wnode {
int weight[maxrank+1];
struct wnode *next;
} WEIGHTPTR,*WEIGHTPTR;

Now install is a funcition that returns a pointer to the frist vector
in the list, Can anyone give the code to define this funcition.?

Thanks:

解决方案

On 2006-06-05, natman <na*******@gmail.com> wrote:

Hi i need to write a funcition called install, its takes as arguments Okey doke.
1- a vector
You''ll need a struct (for an n-dimensional vector):

struct vector {
int direction[n];
int magnitude;
}
2-a number
int will work; long or short may be more appropriate, but I can''t
know without more information.
3-a list called next_level
What kind of list? All programming textbooks have code for linked lists;
the only one I can recommend from experience is C Unleashed by Richard
Heathfield, Lawrence Kirby, and a few others guys.

so heres where it get kinda weird:

next_level is a list comprising of elements that are { vectors, with
pointers}, defined by the following struct

typedef struct wnode {
int weight[maxrank+1];
struct wnode *next;
} WEIGHTPTR,*WEIGHTPTR;

I see a pointer, but I''m not sure how you are representing a vector in
that; I suspect that the +1 allows for magnitude, as well as maxrank
directions.
Now install is a funcition that returns a pointer to the frist vector
in the list, Can anyone give the code to define this funcition.?


Nope. We''ll help you out when you''ve got a compilable example, but until
then we won''t do your homework for you. I''ll give you a hint, though:
Double-linked lists will help you.

--
Andrew Poelstra < http://www.wpsoftware.net/blog >
To email me, use "apoelstra" at the above address.
If we would just let the poachers into the zoo, we''d
have less squashed people and more fancy pianos!


My vectors are defined via

int vector[n]

n dim vector
Andrew Poelstra wrote:

On 2006-06-05, natman <na*******@gmail.com> wrote:

Hi i need to write a funcition called install, its takes as arguments


Okey doke.

1- a vector



You''ll need a struct (for an n-dimensional vector):

struct vector {
int direction[n];
int magnitude;
}

2-a number



int will work; long or short may be more appropriate, but I can''t
know without more information.

3-a list called next_level



What kind of list? All programming textbooks have code for linked lists;
the only one I can recommend from experience is C Unleashed by Richard
Heathfield, Lawrence Kirby, and a few others guys.


so heres where it get kinda weird:

next_level is a list comprising of elements that are { vectors, with
pointers}, defined by the following struct

typedef struct wnode {
int weight[maxrank+1];
struct wnode *next;
} WEIGHTPTR,*WEIGHTPTR;



I see a pointer, but I''m not sure how you are representing a vector in
that; I suspect that the +1 allows for magnitude, as well as maxrank
directions.

Now install is a funcition that returns a pointer to the frist vector
in the list, Can anyone give the code to define this funcition.?


Nope. We''ll help you out when you''ve got a compilable example, but until
then we won''t do your homework for you. I''ll give you a hint, though:
Double-linked lists will help you.

--
Andrew Poelstra < http://www.wpsoftware.net/blog >
To email me, use "apoelstra" at the above address.
If we would just let the poachers into the zoo, we''d
have less squashed people and more fancy pianos!




Ok i have the whole program working, but it is a fair amount of code,
with somestange stuff that really only cofuses people, so i will post
my guess for defining the install func
WEIGHTPTR install ( int *v , int rank , WEIGHTPTR next_level ){
++next_level.next;
return next_level;
}

see previous post for defn of struct WEIGHTPTR,

Andrew Poelstra wrote:

On 2006-06-05, natman <na*******@gmail.com> wrote:

Hi i need to write a funcition called install, its takes as arguments


Okey doke.

1- a vector



You''ll need a struct (for an n-dimensional vector):

struct vector {
int direction[n];
int magnitude;
}

2-a number



int will work; long or short may be more appropriate, but I can''t
know without more information.

3-a list called next_level



What kind of list? All programming textbooks have code for linked lists;
the only one I can recommend from experience is C Unleashed by Richard
Heathfield, Lawrence Kirby, and a few others guys.


so heres where it get kinda weird:

next_level is a list comprising of elements that are { vectors, with
pointers}, defined by the following struct

typedef struct wnode {
int weight[maxrank+1];
struct wnode *next;
} WEIGHTPTR,*WEIGHTPTR;



I see a pointer, but I''m not sure how you are representing a vector in
that; I suspect that the +1 allows for magnitude, as well as maxrank
directions.

Now install is a funcition that returns a pointer to the frist vector
in the list, Can anyone give the code to define this funcition.?


Nope. We''ll help you out when you''ve got a compilable example, but until
then we won''t do your homework for you. I''ll give you a hint, though:
Double-linked lists will help you.

--
Andrew Poelstra < http://www.wpsoftware.net/blog >
To email me, use "apoelstra" at the above address.
If we would just let the poachers into the zoo, we''d
have less squashed people and more fancy pianos!




这篇关于请帮助一个功能 - 请的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆