#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>
using namespace std;
int main()
{
POINT p;
HDC hdc;
COLORREF rgb;
string log;
int r,g,b;
while(true)
{
GetCursorPos(&p);
hdc = GetDC(0);
rgb = GetPixel(hdc,p.x,p.y);
r = GetRValue(rgb);
g = GetGValue(rgb);
b = GetBValue(rgb);
if(GetAsyncKeyState(VK_INSERT)&1){cout<<r<<" "<<g<<" "<<b<<"\n"; log += "r == "; log += r; log +=" &&"; log+=" g == "; log+=g; log+=" && b == "; log+= b; log+="\n";}
if(GetAsyncKeyState(VK_DELETE)&1){system("cls");}
Sleep(2);
ofstream myfile;
myfile.open ("rgb.txt");
myfile << log;
}
}
if(r == 1){
string one = "1";
}
and so on...
cout << GetRValue(rgb);