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 -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -