C++/Console/cout hex
cout: output hex
<source lang="cpp">
- include <iostream>
- include <iomanip>
using namespace std; int main() {
cout << hex << 100 << endl; cout << setfill("?") << setw(10) << 2343.0; return 0;
}
</source>
Set cout: hex and basefield, ios::hex, ios::basefield
<source lang="cpp">
- include <iostream>
- include <iomanip>
using namespace std; int main() {
cout.setf(ios::hex, ios::basefield); cout << 100 << endl; // cout 100 in hex cout.fill("?"); cout.width(10); cout << 2343.0; return 0;
}
</source>