📄 14i.cpp
字号:
#include <iostream.h>
// colors() Separate a 16-bit RGB pixel into individual colors
// IN: pixel is a 16-bit RGB value
// OUT: red, green, and blue are returned as individual color values
void colors (int pixel, int& red, int& green, int& blue)
{ const int FIVEBITS = 0x1F; // lower 5 bits are 1's
red = (pixel >> 10) & FIVEBITS;
green = (pixel >> 5) & FIVEBITS;
blue = pixel & FIVEBITS;
}
void main ()
{ int red, green, blue, pixel = 0x1234;
colors (pixel, red, green, blue);
cout << red << "," << green << "," << blue << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -