outputing numbers
Posted: Sun Nov 14, 2010 7:04 pm
int a = 0x000001;
how would I printf() this or cout it so it displays as 0x000001?
how would I printf() this or cout it so it displays as 0x000001?
The Next Generation of 2D Roleplaying Games
http://elysianshadows.com/phpBB3/
Code: Select all
int a = 1; // With all those zeros in front of the one, without the '0x', I think that it would be octal, though im not %100 on that. This is the safe bet.
cout << "0x00000" << a << endl;
Code: Select all
printf("%#.6x",a);
This is a great reference page, it's all you need language wise AFAIK.Ginto8 wrote:And this is where I got that infoCode: Select all
printf("%#.6x",a);