I have to solve a problem that requires to convert RGB to Hex. I found a solution online, but I don't understand the purpose of the constants 16 and 8. Can someone, please, explain this to me? Thank you
#include <iostream>
#include <sstream>
using namespace std;
int main(){
stringstream ss;
int r,g,b;
cout << "testing" << endl;
cin >> r >> g >> b;
ss << "#" << hex << (r << 16 | g << 8 | b);
cout << ss.str();
return 0;
}