日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

c++笔试题两道,求解当中一道

發布時間:2025/5/22 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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;

第二題求解。


轉載于:https://www.cnblogs.com/hrhguanli/p/5066193.html

總結

以上是生活随笔為你收集整理的c++笔试题两道,求解当中一道的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。