设为首页 加入收藏

TOP

gamesloft C++面试题目
2014-09-23 12:56:31 来源: 作者: 【 】 浏览:95
Tags:gamesloft 面试 题目
  1. 哪些操作会隐式调用C++的拷贝构造函数?
    貌似答案是B和C,是一道选择题,

2.数据结构定义:通道和墙组成的迷宫
这个可以写一个矩阵了,比如   a[x][y]
然后用0表示墙,1表示可以通过
3.一个16×16像素的date画在一个坐标为x,y的屏幕上,屏幕的像素是Wscreen和Hscreen,函数改错.

4.单链表结构定义:节点存储一个整型数,给代码。合并二个已经按照该整型数从小到大排好序的链表,合并后链表也是同样排序好的。
typedef   struct   p
{
int   date;
struct   p   *next;
}node;
Node*   uniteList(Node*   first,Node*second)
{
Node*head=NULL;
Node*cur=NULL;
Node*temp=NULL;
while   (first&&second)
{
if   (first-> key <second-> key)
{
temp=first;
first=first-> next;
}
else
{
temp=second;
second=second-> next;
}

if   (head==NULL)
{
cur=temp;
head=cur;
}
else
{
cur-> next=temp;
cur=temp
}

}
if   (first==NULL)
{
temp=second;
}
else
temp=first;
while   (temp)
{
cur-> next=temp;
temp=temp-> next;
}
cur-> next=NULL;
return   head;
}
5.设计一个函数,找出水仙花数,水仙花数的定义153=1^3+5^3+3^3
貌似要写一个可扩展的水仙花数的程序了…

int i = n;
int j = 0;
while (i != 0) {
int a = (i%10);
j = j + (a*a*a);
i = i/10;
}
6.设计一个函数,找出一个32位的整形二进制数中的1的个数,尽量不要使用逐位比较.

int getBitCount(int n) {
int count = 0;
while (n != 0) {
count+=(n & 1);
n >>=1;
}
return count;
}

7.回文,用递归的查找回文了,填程序.

8.写出一个函数用来判断一个点到一个平面的关系。用一个点和法向量来表示平面。输入一个点和一个面,返回该点在面的前面,后面,还是在这个面上。
bool   loc(Point   pt,Plain   pn)
{
bool   res   =   static_cast <bool> (pn.getl*(po.getx-pn.geta)+pn.getm(po.gety-pn.getb)+pn.getn(po.getz-pn.getc))
return   res;
}

 


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇RESTful的实现:RESTful Web 服务.. 下一篇C++ 数据结构、算法笔试题

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: