• <sub id="h4knl"><ol id="h4knl"></ol></sub>
    <sup id="h4knl"></sup>
      <sub id="h4knl"></sub>

      <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
      1. <strong id="h4knl"></strong>

      2. 網游公司的筆試題大

        時間:2024-08-24 05:11:55 綜合指導 我要投稿
        • 相關推薦

        網游公司的筆試題大集合

          (轉)

        網游公司的筆試題大集合

          1 上海樂升筆試:

          馮諾依曼機的體系結構

          各種RAM的名詞解釋

          遞歸求5!

          C程序優(yōu)化

          翻譯有關windows資源處理的文章

          上機:

          寫api 進行分數的四則運算

          寫api 針對2個8位的數的四則運算 該平臺不支持16位

          寫api 對一個10個元素的數組排序 并且支持檢索

          盧老師教過的放10個球到盒子問題

          2 揚訊科技(手機)寫個MIN(a, b)的宏

          函數指針

          指針數組等

          游戲程序的特點

          游戲程序的結構

          鏈表的插入 索引

          typedef 和 #define 的優(yōu)點和缺點

          你最熟悉的游戲算法

          3 巨人網絡

          1.class String

          {

          public:

          String(const char *cp = NULL);

          String(const String & cp);

          ~String();

          String& operator = (const String & cp);

          operator const char *() const;

          private:

          char *m_data;

          }

          1) 完成類的方法;

          String::String(const char *str)

          {

          if ( str == NULL ) //strlen在參數為NULL時會拋異常才會有這步判斷

          {

          m_data = new char[1] ;

          m_data[0] = \0 ;

          }

          else

          {

          m_data = new char[strlen(str) + 1];

          strcpy(m_data,

          String::String(const String &another)

          {

          m_data = new char[strlen(another.m_data) + 1];

          strcpy(m_data,other.m_data);

          }

          String& String::operator =(const String &rhs)

          {

          if ( this == &rhs)

          return *this ;

          []m_data; //刪除原來的數據,新開一塊內存

          m_data = new char[strlen(rhs.m_data) + 1];

          strcpy(m_data,rhs.m_data);

          return *this ;

          }

          String::~String()

          {

          []m_data ;

          }

          operator const char *() const

          {

          return str;

          }

          2) operator const char *() const 后面的const的作用.

          2.new/和malloc/free的區(qū)別,什么時候需要建立自己的內存分配機制。

          3.static和volatile的用途。

          static:

          4.什么是深拷貝?什么是淺拷貝?舉例說明。

          #include

          #include

          class Base

          {

          private:

          char * name;

          public:

          Base(char * className)

          {

          name = new char[strlen(className)+1];

          strcpy(name, className);

          }

          ~Base()

          {

          name;

          }

          char *copyName()

          {

          char newname[256];

          strcpy(newname, name);

          return newname;

          }

          char *getName()

          {

          return name;

          }

          static void print (Base base)

          {

          printf("name: %s\n",base.name);

          }

          };

          class Subclass : public Base

          {

          public:

          Subclass(char * className) : Base(className)

          {

          }

          };

          int main()

          {

          Base *pBase = new Subclass("test");

          Base::print(*pBase);//用后會被釋放掉,下面的指向將為空指針,應改為引用

          printf("name: %s\n", pBase->getName());

          printf("new name: %s\n", temp);

          return 0;

          }

          對上面程序進行編譯不報錯,但是程序不能執(zhí)行.

          下面是改正后的:

          #include

          #include

          class Base

          {

          private:

          char * name;

          public:

          Base(char * className)

          {

          name = new char[strlen(className)+1];

          strcpy(name, className);

          }

          ~Base()

          {

          name;

          }

          char *copyName()

          {

          char *newname = new char[strlen(name)+1];

          strcpy(newname, name);

          return newname;

          }

          char *getName()

          {

          return name;

          }

          static void print (Base base)

          {

          base.name = base.copyName(); //深度拷貝

          printf("name: %s\n",base.name);

          }

          };

          class Subclass : public Base

          {

          public:

          Subclass(char * className) : Base(className)

          {

          }

          };

          int main()

          {

          Base *pBase = new Subclass("test");

          Base::print(*pBase);//用后會被釋放掉,下面的指向將為空指針,應改為引用

          printf("name: %s\n", pBase->getName());

          char *temp = pBase->copyName();

          printf("new name: %s\n", temp);

          temp;

          return 0;

          }

          5.一個自定義類String的改錯題。

          6.void GetMemory(char *p)

          {

          p = (char *)malloc(100);

          }

          void Test(void)

          {

          char *str = NULL;

          GetMemory(str);

          strcpy(str, "hello world");

          printf(str);

          }

          請問運行Test函數會有什么樣的結果?

          如果函數的參數是一個指針,不要指望用該指針去申請動態(tài)內存。示例7-4-1中,Test函數的語句GetMemory(str, 200)并沒有使str獲得期望的內存,str依舊是NULL,為什么?

          void GetMemory(char *p, int num)

          {

          p = (char *)malloc(sizeof(char) * num);

          }

          void Test(void)

          {

          char *str = NULL;

          GetMemory(str, 100); // str 仍然為 NULL

          strcpy(str, "hello"); // 運行錯誤

          }

          示例7-4-1 試圖用指針參數申請動態(tài)內存

          毛病出在函數GetMemory中。編譯器總是要為函數的每個參數制作臨時副本,指針參數p的副本是 _p,編譯器使 _p = p。如果函數體內的程序修改了_p的內容,就導致參數p的內容作相應的修改。這就是指針可以用作輸出參數的原因。在本例中,_p申請了新的內存,只是把 _p所指的內存地址改變了,但是p絲毫未變。所以函數GetMemory并不能輸出任何東西。事實上,每執(zhí)行一次GetMemory就會泄露一塊內存,因為沒有用free釋放內存。

          如果非得要用指針參數去申請內存,那么應該改用“指向指針的指針”,見示例7-4-2。

          void GetMemory2(char **p, int num)

          {

          *p = (char *)malloc(sizeof(char) * num);

          }

          void Test2(void)

          {

          char *str = NULL;

          GetMemory2(&str, 100); // 注意參數是 &str,而不是str

          strcpy(str, "hello");

          cout<< str << endl;

          free(str);

          }

          7.int i;

          std::list list1;

          for(i = 0; i < 8; i++)

          list1.push_back(i);

          for(std::list::iterator = list1.begin(); iterator != list1.end(); iterator++)

          if (*iterator % 2)

          list1.erase(iterator);

          這段代碼在運行時會產生什么錯誤,怎么改正。

          erase之后iterator失效

          就加一個就完了。

          #include

          int main()

          {

          std::listlist1;

          for(int i=0;i < 8;i++)

          list1.push_back(i);

          for(std::list::iterator it=list1.begin();it!=list1.end();++it)

          {

          if(*it%2 == 0)

          {

          it = list1.erase(it);

          it --;

          }

          }

          return 0;

          }

          8.對Gcc編譯選項做些介紹。

          9.Gdb中如何設置中斷點,逐步調試程序。

          10.游戲編程中如何對顯存進行管理。//這是唯一的一道和游戲直接有關題目。

          11.windows中的內存分配方式有哪些,他們的優(yōu)缺點是什么。


        【網游公司的筆試題大】相關文章:

        網游高薪招聘竟然是噱頭02-19

        大唐公司筆試題02-19

        中國銀行筆試題回顧,新鮮筆經!11-21

        公司面試筆試題11-21

        熱力公司筆試試題09-23

        鐵塔公司筆試試題04-25

        太古地產有限公司筆經02-19

        迅雷JAVA廣州站二筆筆試題目分享11-21

        請關注SHL公司出的試題11-11

        Google公司預選筆試試題02-18

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码
      3. <sub id="h4knl"><ol id="h4knl"></ol></sub>
        <sup id="h4knl"></sup>
          <sub id="h4knl"></sub>

          <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
          1. <strong id="h4knl"></strong>

          2. 日韩欧美久久综合一区 | 图片专区欧美日韩 | 中文字幕AV制服丝袜电影 | 亚洲一区二区三区日韩 | 亚洲成a人片在线 | 亚洲综合五月天久久伊人 |