中軟國際筆試題彙總

2021-06-22 08:16:34 字數 3253 閱讀 3093

#include

//#include

/*void fun(const char * str, int len)

else

}printf("yes\n");

return;

}int strcmp(const char *src,const char *dst) 

} return 0; 

}  */

int add(int * arr,int n)

return num;

*/static int num = 0;

if(n-->0)

return num;

}int main(int argc,char *argv) 

}printf("%d\n",sum);

return 0;

char * str1 = "asdffdsa";

char * str2 = "asdfsa";

fun(str1,strlen(str1));

fun(str2,strlen(str2));

return 0;

char *str1 = "abd"; 

char *str2 = "abd"; 

printf("%d\n",strcmp(str2,str1)); 

return 0; */

int arr = ;

printf("%d\n",add(arr,5));

1、 windows 

下訊息處理機制流程?

sendmessage

和postmessage

的區別。

2、 不用庫函式,實現strcpy

函式。

char * strcpy(char * strdest,const char * strsrc)

3

設計雙鏈表資料結構類:實現增加,瀏覽,刪除,頭刪,尾刪,頭插,尾插;頭刪,尾刪,頭插,尾插需要考慮時間複雜度。

#include

using namespace std;

template

class list;

template

class node

node(t _date)

private:

t date;

node* next;

node* front;

};template

class list

iterator(node*& _p)

iterator operator =(iterator it)

bool operator ==(const iterator & it)

bool operator !=(const iterator & it)

t operator *()

iterator operator ++(int i)

private:

node* p;

};list()

iterator push_front(t _date)

curr->next = head->next;

head->next->front = curr;

head->next = curr;

curr->front = head;

len++;

return iterator(curr);

}iterator push_back(t _date)

curr->next = new node(_date);

curr->next->front = curr;

len++;

return iterator(curr->next);

}iterator begin()

iterator end()

return iterator(curr->next);

}iterator find(const t & _date)

return iterator(curr);

}t back()

return curr->p->date;

}t front()

void clear()

int size()

iterator erase(iterator pos)

if(curr == null)

else

}iterator erase(iterator start, iterator end)

while(tmp != end.p)

if(curr == null || tmp == null)

else

tmp->front = curr->front;

curr->front->next = tmp;

delete curr;

delete tmp->front;

curr = null;

tmp->front = null;

len = len - i;

return iterator(tmp);}}

iterator insert(iterator pos, const t value)

node* tmp = new node(value);

curr->front->next = tmp;

tmp->front = curr->front;

tmp->next = curr;

curr->front = tmp;

return iterator(tmp);

}void sort()

else

}i++;}}

void insert(iterator pos, int num, const t value)

if(curr->next == null)

node* rt = null;

node* rear = null;

node* rhead = null;

int i;

for(i=0;i

rear->next = rt;

rt->front = rear;

rear = rt;

}curr->front = rear;

rear->next = curr;

}private:

int len;

node* head;

node* curr;

};void show(listl)

}int main(int argc, char *argv)

筆試題彙總

對於t n a t n b c n k t 1 c 這樣的遞迴關係,有這樣的結論 if a b k t n o n logb a logb a b為底a的對數 if a b k t n o n k logn if a b k t n o n k a 25 b 5 k 2 a b k 故t n o n...

微軟筆試題 彙總

1.臨界變數critical section的概念 還有semaphore,thread類似的這些 程序進入臨界區的排程原則是 如果有若干程序要求進入空閒的臨界區,一次僅允許乙個程序進入。任何時候,處於臨界區內的程序不可多於乙個。如已有程序進入自己的臨界區,則其它所有試圖進入臨界區的程序必須等待。進...

python筆試題彙總

1 什麼是lambda函式?它有什麼好處?lambda作為乙個表示式,定義了乙個匿名函式。lambda和普通的函式相比,就是省去了函式名稱而已,同時這樣的匿名函式,又不能共享在別的地方呼叫。2 介紹一下except的用法和作用 try except語句用來檢測try語句塊中的錯誤,從而讓except...