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 useto format the output as hex, but instead it printed the followingCode:
By a bit of googling I found that slipping inCode:
iArg1 = 0x4660
iArg2 = 0x255
~iArg1 = 0x4294962635
~iArg2 = 0x4294967040
iArg1 & iArg2 = 0x52
iArg1 | iArg2 = 0x4863
iArg1 ^ iArg2 = 0x4811
instead of cout.setf(cout.hex);, the program would format the output in the format the book had shown.Code:
cout << hex;
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.Code:
iArg1 = 0x1234
iArg2 = 0xff
~iArg1 = 0xffffedcb
~iArg2 = 0xffffff00
iArg1 & iArg2 = 0x34
iArg1 | iArg2 = 0x12ff
iArg1 ^ iArg2 = 0x12cb
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 :p) 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.