请帮助,奇怪的行为 [英] Help please, strange behavior

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

问题描述

对不起,我把它发布在其他组合中,我没有看到它,而且这个组是最有效的,我把它转发到这里,对不起/>
mutliposting:




我用的是VC6,我有这个声明:


typedef struct tagTLimite {

double Debut;

double Fin;

} Limites;


typedef struct TagElemTab {

double NivY;

bool Existe;

std :: vector< LimitesPtLimites;

} ElemTabCont;


void myfunc()

{

......

ElemTabCont * ContNonOrd; //轮廓非ordone

long nbNiveau =(yhi-ylo)/ stepY +1;

ContNonOrd = new ElemTabCont [nbNiveau];

......

}

i不知道为什么,nbNiveau等于(yhi-ylo)/ stepY,它没有't

+1 ????即使我放了:

ContNonOrd = new ElemTabCont [nbNiveau + 1]; ContNonOrd的大小=

nbNiveau ????

i''m sorry i posted this in other groupes, and i didn''t see it, and as
this group is most actif, i repost it here, and sorry for
mutliposting:

Hi,
i''m using VC6, i have this declaration:

typedef struct tagTLimite {
double Debut;
double Fin;
}Limites;

typedef struct TagElemTab {
double NivY;
bool Existe;
std::vector<LimitesPtLimites;
}ElemTabCont;

void myfunc( )
{
......
ElemTabCont * ContNonOrd;//contour non ordone
long nbNiveau = (yhi-ylo)/stepY +1 ;
ContNonOrd = new ElemTabCont [nbNiveau];
......
}
i don''t know why,nbNiveau is equal to (yhi-ylo)/stepY, it didn''t
+1????and even if i put:
ContNonOrd = new ElemTabCont [nbNiveau+1]; the size of ContNonOrd =
nbNiveau????

推荐答案

Simply_Red写道:
Simply_Red wrote:

对不起,我把它发布在其他组合中,我没有看到它,而且这个组是最有效的,我是b $ b把它转发到这里,抱歉

mutliposting:




我用的是VC6,我有这个声明:


typedef struct tagTLimite {

double Debut;

double Fin;

} Limites;


typedef struct TagElemTab {

double NivY;

bool Existe;

std :: vector< ; LimitesPtLimites;

} ElemTabCont;


void myfunc()

{

... ..

ElemTabCont * ContNonOrd; //轮廓非ordone

long nbNiveau =(yhi-ylo)/ stepY +1;
i''m sorry i posted this in other groupes, and i didn''t see it, and as
this group is most actif, i repost it here, and sorry for
mutliposting:

Hi,
i''m using VC6, i have this declaration:

typedef struct tagTLimite {
double Debut;
double Fin;
}Limites;

typedef struct TagElemTab {
double NivY;
bool Existe;
std::vector<LimitesPtLimites;
}ElemTabCont;

void myfunc( )
{
.....
ElemTabCont * ContNonOrd;//contour non ordone
long nbNiveau = (yhi-ylo)/stepY +1 ;



''yhi'''''ylo'',''stepY''的类型是什么?他们的价值观是什么?

nbNiveau有什么价值?你有什么期望?


有可能你遇到了舍入(在
整数除法的情况下截断)并且添加1并不是做你需要的东西

它要做。

What is the type of ''yhi'', ''ylo'', ''stepY''? What are their values?
What value do you get in ''nbNiveau''? What did you expect?

It is possible that you''re encountering rounding (truncation in
case of integer division) and adding 1 doesn''t do what you need
it to do.


ContNonOrd = new ElemTabCont [nbNiveau];

.. ......

}

i不知道为什么,nbNiveau等于(yhi-ylo)/ stepY,它没有

+1 ????即使我放了:

ContNonOrd = new ElemTabCont [nbNiveau + 1]; ContNonOrd的大小=

nbNiveau ????
ContNonOrd = new ElemTabCont [nbNiveau];
.....
}
i don''t know why,nbNiveau is equal to (yhi-ylo)/stepY, it didn''t
+1????and even if i put:
ContNonOrd = new ElemTabCont [nbNiveau+1]; the size of ContNonOrd =
nbNiveau????



最后一句话超出了我。你是什​​么意思

ContNotOrd的大小?你怎么知道这个尺寸?怎么样?b $ b与你要求的尺寸不同?


V

-

请在通过电子邮件回复时删除大写''A'

我没有回复最热门的回复,请不要问

That last statement is beyond me. What do you mean by "the size of
ContNotOrd"? How the hell can you know the size? How can it be
different from the size you requested?

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask

14fév,14:12,Victor Bazarov < v.Abaza ... @ comAcast.netwrote:
On 14 fév, 14:12, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:

Simply_Redwrote:
Simply_Redwrote:

i''对不起,我发布了这个在其他集团,我没有看到它,并且作为

这个组是最有效的,我在这里重新发布,并抱歉

mutliposting:
i''m sorry i posted this in other groupes, and i didn''t see it, and as
this group is most actif, i repost it here, and sorry for
mutliposting:




我使用VC6,我有这个声明:
Hi,
i''m using VC6, i have this declaration:


typedef struct tagTLimite {

double Debut;

double Fin;

} Limites ;
typedef struct tagTLimite {
double Debut;
double Fin;
}Limites;


typedef struct TagElemTab {

double NivY;

bool Existe;

std :: vector< LimitesPtLimites;

} ElemTabCont;
typedef struct TagElemTab {
double NivY;
bool Existe;
std::vector<LimitesPtLimites;
}ElemTabCont;


void myfunc()

{

.....

ElemTabCont * ContNonOrd; //轮廓非ordone

long nbNiveau =(yhi-ylo)/ stepY +1;
void myfunc( )
{
.....
ElemTabCont * ContNonOrd;//contour non ordone
long nbNiveau = (yhi-ylo)/stepY +1 ;






''yhi''的类型是什么,''ylo'',' stepY'?他们的价值观是什么?

nbNiveau有什么价值?你期待什么
What is the type of ''yhi'', ''ylo'', ''stepY''? What are their values?
What value do you get in ''nbNiveau''? What did you expect



yhi,ylo,stepY是双打值:分别为16,0,0.1

我在nbNiveau得到160,我需要161.



y ylo, stepY are doubles values: 16, 0, 0.1 respectively
I get 160 in nbNiveau, and I need 161.
?


>

您可能遇到舍入(截断

整数的情况分区)并且添加1并不是你需要的东西

它要做。
>
It is possible that you''re encountering rounding (truncation in
case of integer division) and adding 1 doesn''t do what you need
it to do.

ContNonOrd = new ElemTabCont [nbNiveau]; < br $> b $ b .....

}

i不知道为什么,nbNiveau等于(yhi-ylo)/ stepY,它没有't

+1 ????即使我放了:

ContNonOrd = new ElemTabCont [nbNiveau + 1]; ContNonOrd的大小=

nbNiveau ????
ContNonOrd = new ElemTabCont [nbNiveau];
.....
}
i don''t know why,nbNiveau is equal to (yhi-ylo)/stepY, it didn''t
+1????and even if i put:
ContNonOrd = new ElemTabCont [nbNiveau+1]; the size of ContNonOrd =
nbNiveau????


最后一句话超出了我。你是什​​么意思

ContNotOrd的大小?你怎么知道这个尺寸?怎么可能与你要求的尺寸不同?

That last statement is beyond me. What do you mean by "the size of
ContNotOrd"? How the hell can you know the size? How can it be
different from the size you requested?



i只需在观察窗口中验证ContNotOrd [160]。



i just verify in watch window ContNotOrd[160].



Simply_Red写道:
Simply_Red wrote:

对不起我在其他组合中发布了这个,我没有看到它,并且

这个group is is actif,我把它转发到这里,抱歉

mutliposting:




我正在使用VC6,我有这个声明:


typedef struct tagTLimite {

double Debut;

double Fin;

} Limites;


typedef struct TagElemTab {

double NivY;

bool Existe;

std :: vector< LimitesPtLimites;

} ElemTabCont;


i''m sorry i posted this in other groupes, and i didn''t see it, and as
this group is most actif, i repost it here, and sorry for
mutliposting:

Hi,
i''m using VC6, i have this declaration:

typedef struct tagTLimite {
double Debut;
double Fin;
}Limites;

typedef struct TagElemTab {
double NivY;
bool Existe;
std::vector<LimitesPtLimites;
}ElemTabCont;
[redacted]



除了Victor对你说,上面的定义是C-ish

而且并不是真的需要。它们应该是:


struct Limites {

double Debut;

double Fin;

} ;


struct ElemTabCont {

double NivY;

bool Existe;

std :: vector< ; LimitesPtLimites;

};


没有typedef或tag名字是必要的。

In addition to what Victor said to you, the definitions above are C-ish
and not really needed. They should be:

struct Limites {
double Debut;
double Fin;
};

struct ElemTabCont {
double NivY;
bool Existe;
std::vector<LimitesPtLimites;
};

No typedefs or "tag" names are necessary.


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

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