Converting hex to dec C++ -


convert hex:

cout << hex << int(x) << endl; 

how convert conversely, hex dec?

enter hex number simple:

cin >> hex >> x; 

you can use std::dec io manipulator:

std::cout << std::dec << int(x) << endl; 

note necessary if have used std::hex or other means manipulate base of std::cout. otherwise need take no action: default int decimal.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -