hey all,
I'm writing a C++ console app that converts all the letters of a string to an ALT+NUM equivalent. e.g. e might convert to é (or ALT+1154)
My problem is only with those ALT+NUM combos that have to start with a 0
For example with letter 'd' the only equivalent is Ð (ALT+0208).

cout<<(char)0208;

That clearly won't work so does anyone know another way??

Thanks very much,
Coop

Recommended Answers

All 4 Replies

May I ask how you process the e example since cout<<(char)1154; is equally likely not to work?

-

As I understand ur problem, u like to convert ascii code to character
To do so, define a integer variable and initialize it to 1st character asicc code and then assign it to character variable and then print it.

and u like to print all the character for that use loop increment the integer variable and assign to character variable and print it
for further help explain ur problem

I hope it will help you
Best Of Luck.

cout<<(char)0208;

BTW you do know that the leading 0 on 0208 effectively tells the compiler that the number is in octal (base 8) in the same way 0x indicates a hexadecimal number?

Have you tried

cout << setw(4) << setfill('0') << 208;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.