Human language in c/c++

Before hand I thank all for reading and especially those how try to help

I want to know do we have c or c++ in other languages?

Second question is that before compiling my code I can type after printf command messages in any language I want and after compilation those languages are not displayed at all and all I can see is some strange characters


I want to know do we have c or c++ in other languages?
What?

Second question is that before compiling my code I can type after printf command messages in any language I want and after compilation those languages are not displayed at all and all I can see is some strange characters
You mean comments? Like that?
1
2
3
4
5
6
std::cout << "Hello"; //Outputs greeting to user
return 0;

/* Will add two numbers together
   and output it to the screen */
void add(int a, int b)
For second question I mean this

printf("حال شما خوب است") I can type this before compiling and after compilation It wont display

For first question I mean do we have translation of c or c++ languages in other languages?
I can type this before compiling and after compilation It wont display
I doubth that those characters can fit to the extended ASCII set, so using printf is out of question. You can try wprintf, but you will have to correctly set your locale and save source file with correct encoding. Not t mention that Windows console is really bad at Unicode support.

do we have translation of c or c++ languages in other languages?
No. Even if we would it would not be C++ anymore as it not conforms Standard.
I got answer to second from you
But still first part is not clear
see I can type in note and word in any language i want but in that black screen those characters vanishes
printf does not support anything aside from extended ASCII set. Windows console is really bad at Unicode support too.
You need to learn about different encodings, what is the difference, learn about what different versons of functions support, about locales and how do they work. And it is still unlikely that your program will work for everyone if you will use standard console.

Some info you might find useful: http://www.cprogramming.com/tutorial/unicode.html
Last edited on
thanks MiiNiPaa
hope after reading about encoding i can use other languages
For you second question
If you are on UNIX, the console should show output of something like cout << "حال شما خوب است"; just fine.

If you are on Windows then as MiiNiPaa said the console does not support UTF-8/other encoding by default.

You can however change the default encoding to UTF-8. Read here http://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8

or try SetConsoleOutputCP(65001); //Same as "chcp 65001" exectured from command prompt before the cout

Read here as well http://www.cplusplus.com/forum/unices/12944/

*post edited: Apart from this steps you will also need to set the command prompt font to one that has correct glyphs for your language. I just quickly checked on Windows. The command prompt shows boxes as the font does not have the glyphs. Cygwin console shows correct characters though.
Last edited on
thanks codewalker very useful reply
Topic archived. No new replies allowed.