Can ASCII code for a char be printed in C++ like in C? -


as can print ascii code , increment in c --> e.g:

{ char ch='a'; ch++; printf("%d",ch);  } 

this output "66" on console.

how can done in c++ ??

printf work in c++. if want use cout, need cast:

char ch = 'a'; ch++; std::cout << static_cast<int>(ch); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -