If you have the following code:
cout << hex << 10;
The output is "a", which means that decimal 10 is converted to a hexadecimal value.
However, in the code below ...
int n; cin >> hex >> n; cout << n << endl;
When input 12, the output becomes 18. Can someone explain the details of the conversion? How did it become a decimal value?
I'm interested in the point where it became int. If it is broken, it will be:
(( cin >> hex ) >> n);
Is it correct?
source share