0

Why is this code showing compilation error?

https://code.sololearn.com/c45TfnOLPwZ7/?ref=app

6th Dec 2018, 6:46 AM
Nawrin Tabassum
5 Answers
+ 3
Because while copying/pasting your code to the playground some illegal characters from the document in which you copied the code is also got paste there. See this: cpp.sh/7c4u5
6th Dec 2018, 6:57 AM
Babak
Babak - avatar
+ 3
"Is it valid?" To some extent! To make it possible to correctly handle the wide character set (e.g. Unicode) you'd do it this way #include <iostream> #include <stdio.h> #include <io.h> // Windows-specific header #include <fcntl.h> using namespace std; int main() { _setmode(_fileno(stdout), _O_U8TEXT); // Sets the file translation mode š wprintf(L"\xFEFF"); // Byte order mark (magic number necessary to work with Unicode) ² wchar_t w = L'ب'; //wcin >> w; wcout << L"Wide character value:: " << w << endl; return 0; } Output: ب _____ š https://docs.microsoft.com/en-us/previous-versions/tw4k6df8(v=vs.140) ² https://en.wikipedia.org/wiki/Byte_order_mark https://code.sololearn.com/cWtSLDT8JYCn
6th Dec 2018, 8:24 AM
Babak
Babak - avatar
+ 1
Some special symbol are present inn your code so it giving error this special symbol come because of copy the code from your notepad to sololearn fixed now https://code.sololearn.com/cpkcP36Vikzf/?ref=app
6th Dec 2018, 6:54 AM
MsJ
MsJ - avatar
+ 1
Thanks for helping 😊
6th Dec 2018, 5:16 PM
Nawrin Tabassum
0
Can you please tell me a way to take input from user which I want to assign to a variable of wchar_t data type? I found this way. Is it valid? https://code.sololearn.com/c91P7zSbxnwM/?ref=app
6th Dec 2018, 7:25 AM
Nawrin Tabassum