c++筆試題兩道,求解其中一道,兩道求解

來源:互聯網
上載者:User

c++筆試題兩道,求解其中一道,兩道求解

1.Implement a functionthat prints the numbers from 1 to 100.But for multiples of three(3) print “Zif”insteadof the number and for the multiples of five(5) print “Nab”. For numbers whichare multiples of both three and five print “ZifNab”.

void printZifNab(int from, int to){if (from > to) return;for (int i = from; i <= to; i++){if ((i % 3 == 0) && (i % 5 == 0)){printf("ZifNab\n");}else if ((i % 3 == 0)){printf("Zif\n");}  else if ((i % 5 == 0)){printf("Nab\n");}else {printf("%d\n", i);}}}

2. unsigned short ConvertRGB888toRBG565(unsigned int nSourceColor)

Parameters: nSourceColor – 32 Bits RGB color to convert.

Return: The converted color as a 16 Bits RGB color.

This function converts an RGB 32 bits color format to RGB 16 bits color format. The 32 bits formats contains 8 bits of empty padding.8 bits for RED.8 bits for GREEN and 8 bits for BLUE. In that order. Now you have to down convert this value to 16 bits. By have 5 bits for RED, 6 bits for GREEN and finally 5 bits for the BLUE.

Color Help:

Red = 0x00FF0000

Green = 0x0000FF00;

Blue = 0x000000FF;

White = 0x00FFFFFF;

Black = 0x00000000;

第二題求解。



兩道企業筆試題

1.
甲:50歲
乙:32歲
另外三人:49、10、5
解答:因為滿足三個數相乘等於2450的組合有7個。但是其中有兩個相加都等於64(10、5、49和50、7、7),其他都沒有重複。所以乙年齡為32。但是甲說,三個人年齡都比甲小,那麼說明甲50歲,而其他三個就是10、5、49咯。

2.取標籤為兩水果的那框。裡面取出的如果是蘋果,那麼這一定就是蘋果筐了,剩下的標了蘋果的就是橘子,標了橘子的就是兩水果。
同理,取出的如果是橘子,這框一定是橘子筐,剩下的標了橘子的就是蘋果,標了蘋果的一定是兩水果。
(這樣的邏輯題,稍微整理一下思路就可以了。如果你整理不出思路,也可以用排除法。——肯定不能選標了蘋果或者橘子那筐。因為這兩個實質是一樣的,只能選三個中與眾不同的那個)
 
兩道簡單的c#筆試題進來解答一下(要解題過程)

使用treeview控制項類或者xml類不就可以了。

請問,你能給我400分嗎,我發現我差400分就可以升級了。
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.