您当前所在位置:
88好学网范文常识招聘应聘笔试2017年海康威视校园招聘笔试题» 正文

2017年海康威视校园招聘笔试题

[05-18 22:30:27]   来源:http://www.88haoxue.com  笔试   阅读:680

概要:class lclass : public Bclass{public:lclass(int i , int j , int k) : Bclass(i , j){z = k;}int fun(){return (x+y+z)/3;}private:int z;};int main(void){lclass obj(2,4,10);Bclass p1 = obj;cout<Bclass &p2 = obj;cout<cout<Bclass *p3 = &obj;cout return 0;}输出结果:050512、如何减少频繁分配内存(malloc或者new)造成的内存碎片?(10分)13、请写出strchr的实现(10分)函数功能:找出在字符串str中第一次出现字符ch的位置,找到就返回该字符位置的指针(也就是返回该字符在字符串中的地址的位置),找不到就返回空指针(就是NULL)const char* strchr(const char* str , char ch)const char* strchr(const char* str , cha

2017年海康威视校园招聘笔试题,标签:笔试大全,http://www.88haoxue.com
  class lclass : public Bclass

  {

  public:

  lclass(int i , int j , int k) : Bclass(i , j)

  {

  z = k;

  }

  int fun()

  {

  return (x+y+z)/3;

  }

  private:

  int z;

  };

  int main(void)

  {

  lclass obj(2,4,10);

  Bclass p1 = obj;

  cout<

  Bclass &p2 = obj;

  cout<

  cout<

  Bclass *p3 = &obj;

  cout

  return 0;

  }输出结果:

  0

  5

  0

  5

  12、如何减少频繁分配内存(malloc或者new)造成的内存碎片?(10分)

  13、请写出strchr的实现(10分)

  函数功能:找出在字符串str中第一次出现字符ch的位置,找到就返回该字符位置的指针(也就是返回该字符在字符串中的地址的位置),找不到就返回空指针(就是NULL)

  const char* strchr(const char* str , char ch)

  const char* strchr(const char* str , char ch)

  {

  char *p = NULL;

  const char* s = str;

  for( ; *s != '\0' ; ++s)

  {

  if(*s == ch)

  {

  p = (char *)s;

  break;

  }

  }

  return p;

  }

  const char* strchr(const char* str , char ch)

  {

  char *p = NULL;

  const char* s = str;

  for( ; *s != '\0' ; ++s)

  {

  if(*s == ch)

  {

  p = (char *)s;

  break;

  }

  }

  return p;

  }

  14、请写出冒泡排序法算法(20分)

  void BubbleSort(int r[] , int n);

  void BubbleSort(int r[] , int n)

  {

  int i , j , temp;

  for(i = 0 ; i < n - 1 ; ++i)

  {

  for(j = 0 ; j < n-i-1 ; ++j)

  {

  if(r[j] > r[j + 1])

  {

  temp = r[j];

  r[j] = r[j + 1];

  r[j + 1] = temp;

  }

  }

  }

  }

  void BubbleSort(int r[] , int n)

  {

  int i , j , temp;

  for(i = 0 ; i < n - 1 ; ++i)

  {

  for(j = 0 ; j < n-i-1 ; ++j)

  {

  if(r[j] > r[j + 1])

  {

  temp = r[j];

  r[j] = r[j + 1];

  r[j + 1] = temp;

  }

  }

  }

  }

上一页  [1] [2] [3] [4] 


Tag:笔试笔试大全招聘应聘 - 笔试
》《2017年海康威视校园招聘笔试题》相关文章