且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在线C ++编程测试

更新时间:2023-02-07 17:16:54



"史蒂夫福克斯" < XX ** @ null.com>在消息中写道

news:XHEPf.12858

"Steve Fox" <xx**@null.com> wrote in message
news:XHEPf.12858


eP4.690@trnddc05 ...
eP4.690@trnddc05...
我一直在做C ++ for 13多年来被要求参加在线C ++
编程测试。

什么笑!


大多数在线C ++''测试''是。

对于一个明显知道不及你的人进行测试是令人沮丧的
做....并且不知道写这样的测试。


欢迎来到真实世界(tm):-)

例如

问题10:
>为SomeClass类型的对象分配的字节大小是多少?

class SomeClass
公共:
int x;
int y;
};
I have been doing C++ for 13 years and was asked to take an online-C++
programming test.

WHAT A JOKE!!!
Most online C++ ''tests'' are.

It''s frustrating taking a test by someone who obviously knows less than
you
do....and doesn''t know enough to write such a test.
Welcome to the Real World(tm) :-)

e.g.

Question 10:

What is the size in bytes allocated for objects of the type SomeClass?
class SomeClass
{
public:
int x ;
int y ;
} ;




我不知道他们的答案是什么,但真正的答案是:
>
sizeof(SomeClass)> = 4

-Mike



I don''t know what ''their'' answer is, but the real answer is:

sizeof(SomeClass) >= 4
-Mike


Mike Wahler写道:
Mike Wahler wrote:
为SomeClass类型的对象分配的字节大小是多少?

class SomeClass
{
public:
int x;
int y;
};
What is the size in bytes allocated for objects of the type SomeClass?
class SomeClass
{
public:
int x ;
int y ;
} ;



我不知道他们的回答是什么,但真正的答案是:

sizeof(SomeClass)> = 4



I don''t know what ''their'' answer is, but the real answer is:

sizeof(SomeClass) >= 4




不。 ''sizeof(SomeClass)> = 2'':在''sizeof(int)'的平台上'

与''sizeof(char)'相同'没有必要浪费两个

额外的话。当然,这样的平台每个char可能会使用至少16位

,甚至更多(例如32或64)。公平地说,

我从来没有在这样的机器上工作。

-

< mailto:di ****** *****@yahoo.com> < http://www.dietmar-kuehl.de/>

< http://www.eai-systems.com> - 高效的人工智能



Nope. ''sizeof(SomeClass) >= 2'': on platforms for ''sizeof(int)''
is identical to ''sizeof(char)'' there is no need to waste two
extra words. Of course, such platforms will use at least 16 bits
for each ''char'' probably even more (e.g. 32 or 64). To be fair,
I have never worked on such a machine.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence