c++ - cout print hex instead of decimal -
has occurred simple std::cout
might print value in hex format when supposed format decimal(like integer)?
for example, have line :
std::cout << "_agent [" << target << "] still among " << ((target->currworker)->getentities().size()) << " entities of worker[" << target->currworker << "]" << std::endl;
which print :
_agent [0x2c6d530] still among 0x1 entities of worker[0x2c520f0]
note:
1-the said out put sometime decimal , times hex
2- behaviour smae if change ((target->currworker)->getentities().size())
(int)((target->currworker)->getentities().size())
any hints?
thanks
you have set std::cout print hex in prior in context of code forget reset. example:
std::cout<<std::hex<<12; /*blah blah blah*/ std::cout<<12; //this print in hex form still
so have following
std::cout<<std::dec<<12;
to print in decimal form.
Comments
Post a Comment