关键词不能为空

当前您在: 主页 > 高中公式大全 >

欢乐圣诞佳音程序员面试经典试题

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-01-21 04:02
tags:

统计分析报告范文-hostages

2021年1月21日发(作者:刘沧龙)
1
、现有
1000
个苹果,
10
个盒子,问各个盒子内应该 分别放入多少
个苹果,才能使得用户要买任意
1

1000
之间的一 个苹果数,都可
以给他(卖的时候是整个盒子卖,不能拆盒子的包装)



2
、请仔细阅读下面的资料:


1
)材料一:
CArray
template<
class
TYPE,
class
ARG_TYPE
>
class
CArray
:
public
CObject
Parameters:
TYPE
Template parameter specifying the type of objects stored in the array.

TYPE is a parameter that is returned by CArray.
ARG_TYPE
Template parameter specifying the argument type used to access objects
stored in the array.

Often a reference to TYPE. ARG_TYPE is a parameter that is passed to
CArray.
Remarks:
The CArray class supports arrays that are are similar to C arrays, but can
dynamically shrink and grow as necessary.

Array indexes always start at position 0. You can decide whether to fix
the upper bound or allow the array to expand when you add elements past
the current bound. Memory is allocated contiguously to the upper bound,
even if some elements are null.

int CArray::Add (ARG_TYPE newElement);

Return Value:
The index of the added element.
Parameters:
ARG_TYPE
Template
parameter
specifying
the
type
of
arguments
referencing
elements in this array.
newElement
The element to be added to this array.

TYPE& CArray::operator [] (int nIndex);
Parameters:
TYPE
Template parameter specifying the type of elements in this array.
nIndex
Index of the element to be accessed.
Remarks:
Returns the array reference of element at the specified index.

2
)材料二:
CList
templateclass CList : public CObject
Parameters:
TYPE
Type of object stored in the list.
ARG_TYPE
Type used to reference objects stored in the list. Can be a reference.
Remarks:
The
CList
class
supports
ordered
lists
of
nonunique
objects
accessible
sequentially or by value.

CList lists behave like doubly-linked lists.


void CList::AddTail(ARG_TYPE newElement);
Parameters:
ARG_TYPE
Template
parameter
specifying
the
type
of
the
list
element
(can
be
a
reference).
newElement
The element to be added to this list.
Remarks:
Adds a new element or list of elements to the tail of this list. The list can
be empty before the operation.

3
)材料三
: realloc
realloc
Reallocate memory blocks.
void *realloc(void *memblock, size_t size);
Return Value:
The return value points to a storage space that is guaranteed to be suitably
aligned for storage of any type of object. To get a pointer to a type other
than void, use a type cast on the return value.
Remarks:
The size argument gives the new size of the block, in bytes. The contents
of
the
block
are
unchanged
up
to
the
shorter
of
the
new
and
old
sizes,
although the new block can be in a different location. Because the new
block can be in a new memory location, the pointer returned by realloc is
not guaranteed to be the pointer passed through the memblock argument.

4
)请指出下面这段代码可能会出现的问题

CListARIANT*, V
ARIANT*> g_ValueList;
CArrayARIANT, const V
ARIANT&> g_ValuePool;
void AddNewValue (const V
ARIANT& newValue)
{
g_l(&g_ValuePool[g_(newValue)]);
}

3
、有一无符号整型数组,大小为
10,
初始的数值随机,但在
[0,
99]
之间。请用
C
语言写 一个过滤程序,令数组内的数据互不相等。

说明:

1.
若数组内 有相等的数据,可令某一数值加
1
或减
1
作出偏移,直至
不等为止。

2.
数组内的数据只能在
[0, 99]
之间。

3.
保持数组内的数据位置不变,即对应下标不变。


4


按要求编写以下函数。

功能:将给定缓冲区中的
#
字符移到字符串尾部

函数名称:
ChangeToTail
入口参数:
pSZ
指向缓冲区的指针
, nSize
缓冲区长度

出口:
pSZ
所指缓冲区中的
#
字符被移到缓冲区尾部
< br>返回值:
在出口缓冲区中第一个
#
的位置
,
若缓冲区中无#
字符则返回
-1





入< br>#W#W#W#WW#


10








WWWWW#####
并且返回值为
5
int ChangeToTail(BYTE* pSZ, UINT nSize)
{

统计分析报告范文-hostages


统计分析报告范文-hostages


统计分析报告范文-hostages


统计分析报告范文-hostages


统计分析报告范文-hostages


统计分析报告范文-hostages


统计分析报告范文-hostages


统计分析报告范文-hostages



本文更新与2021-01-21 04:02,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/542259.html

程序员面试经典试题的相关文章

  • 爱心与尊严的高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊严高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊重的作文题库

    1.作文关爱与尊重议论文 如果说没有爱就没有教育的话,那么离开了尊重同样也谈不上教育。 因为每一位孩子都渴望得到他人的尊重,尤其是教师的尊重。可是在现实生活中,不时会有

    小学作文
  • 爱心责任100字作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任心的作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文