Mega Code Archive

 
Categories / C++ / Data Type
 

Decimal in hexadecimal

#include <iostream> using namespace std; int main() {   int x = 100;   double f = 98.6;   double f2 = 123456.0;   double f3 = 1234567.0;   cout.setf(ios::hex, ios::basefield);   cout << "x in hexadecimal: " << x << endl;   return 0; }