I've been slowly working my way through C++ for Dummies 5th Edition and I have met a slight predicament.

The book told me to use
Code:
cout.setf(cout.hex);
to format the output as hex, but instead it printed the following

Code:
iArg1        = 0x4660
iArg2        = 0x255
~iArg1       = 0x4294962635
~iArg2       = 0x4294967040
iArg1 & iArg2 = 0x52
iArg1 | iArg2 = 0x4863
iArg1 ^ iArg2 = 0x4811
By a bit of googling I found that slipping in
Code:
cout << hex;
instead of cout.setf(cout.hex);, the program would format the output in the format the book had shown.

Code:
iArg1        = 0x1234
iArg2        = 0xff
~iArg1       = 0xffffedcb
~iArg2       = 0xffffff00
iArg1 & iArg2 = 0x34
iArg1 | iArg2 = 0x12ff
iArg1 ^ iArg2 = 0x12cb
I just wanted to ask if it was ok using "cout << hex;" as I would hate to develop any nasty habits this early on that would cause me problems later.

Also, would anyone have any idea why the method the book used didnt work? I even copied the code from the CD (I know thats the worst thing i could do while learning, but i was desperate ) to make sure i had not made any errors.

I do apologise if this is a simple problem, making the thread a waste of time for anyone that reads it, but i googled and searched these forums and couldnt find a thing .

I also feel bad for my first post being a post asking for help.