上述程序在編譯成Release版本后無法讀取第二個green的顏色值,所以最好把unsigned char改成unsigned int: // ColorRGB.cpp : Defines the entry point for the console application. //
#include "stdafx.h" #include <stdio.h>
int _tmain(int argc, _TCHAR* argv[]) { unsigned int red, green, blue; while (1) { printf("Please input the three RGB values: \n"); scanf_s("%d%d%d", &red, &green, &blue); printf("The result is: #%02X%02X%02X\n\n", red, green, blue); } return 0; }
|