cplusplus.com
C++ : Forum : Beginners : type word
 
cplusplus.com
Information
Documentation
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs


post type word

ripley (51)
hello,

i am very new to c++. and i am having problem like this:

i definied a new type

typedef unsigned short int word

word k[5] = {0xaaaa, 0xbbbb, 0xaccc, 0x0101, 0x3333};
for(int i=0; i<5; i++)
cout << (k[i]) <<"\n";

and i want to print it in hexa format, as it was on input. can anybody tell me how to do it with the easiest way? thank you.

r
Bazzy (6258)
cout << hex << k[i];
http://www.cplusplus.com/reference/iostream/manipulators/hex/
ripley (51)
thank you :)
Topic archived. No new replies allowed.