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分就可以升級了。