一共是8道題目
1.哪些操作會隱式調用C++的拷貝構造函數?
貌似答案是B和C,是一道選擇題來的,
2.資料結構定義:通道和牆組成的迷宮
這個可以寫一個矩陣了,比如 a
然後用0表示牆,1表示可以通過
3.一個16x16圖元的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 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
貌似要寫一個可擴展的水仙花數的程式了...
6.設計一個函數,找出一個32位元的整形二進位數字中的1的個數,儘量不要使用逐位比較.
7.回文,用遞迴的查找回文了,填程式.
8.寫出一個函數用來判斷一個點到一個平面的關係。用一個點和法向量來表示平面。輸入一個點和一個面,返回該點在面的前面,後面,還是在這個面上。
bool loc(Point pt,Plain pn)
{
bool res = static_cast (pn.getl*(po.getx-pn.geta)+pn.getm(po.gety-pn.getb)+pn.getn(po.getz-pn.getc))
return res;
}
一大早起來敲,敲得好辛苦啊!!
給大家分享分享了。。。。。。。。部分程序答案沒拿到。。鬱悶...
1.哪些操作會隱式調用C++的拷貝構造函數?
貌似答案是B和C,是一道選擇題來的,
2.資料結構定義:通道和牆組成的迷宮
這個可以寫一個矩陣了,比如 a
然後用0表示牆,1表示可以通過
3.一個16x16圖元的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 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
貌似要寫一個可擴展的水仙花數的程式了...
6.設計一個函數,找出一個32位元的整形二進位數字中的1的個數,儘量不要使用逐位比較.
7.回文,用遞迴的查找回文了,填程式.
8.寫出一個函數用來判斷一個點到一個平面的關係。用一個點和法向量來表示平面。輸入一個點和一個面,返回該點在面的前面,後面,還是在這個面上。
bool loc(Point pt,Plain pn)
{
bool res = static_cast (pn.getl*(po.getx-pn.geta)+pn.getm(po.gety-pn.getb)+pn.getn(po.getz-pn.getc))
return res;
}
一大早起來敲,敲得好辛苦啊!!
給大家分享分享了。。。。。。。。部分程序答案沒拿到。。鬱悶...