in Education by
Sorry for what may sound simple, but I am trying to draw just a simple box in Visual Studio 2017 using the unicode characters from https://en.wikipedia.org/wiki/Box-drawing_character using the code below #include using namespace std; int main() { cout << "┏━━━━━━━━━━━━━━━━━┓" << endl; cout << "┃" << endl; and so on... However, whenever I run it all of the above code simply outputs as a ? wherever there should be a line. So is it possible to output code like this directly to the console or for each character do I have to write the numeric values for each character? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Windows console supports UTF-16LE UNICODE. You can use some box-driving library like PDCurses for example. Otherwise you can use the following approach #include #include class output_swap { output_swap(const output_swap&) = delete; output_swap operator=(output_swap&) = delete; public: output_swap( ) noexcept: prevCP_( ::GetConsoleCP() ) { ::SetConsoleCP( CP_WINUNICODE ); ::SetConsoleOutputCP( CP_WINUNICODE ); } ~output_swap() noexcept { ::SetConsoleCP( prevCP_ ); ::SetConsoleOutputCP( prevCP_ ); } private: ::DWORD prevCP_; }; void draw_text(const wchar_t* text) { static ::HANDLE _out = ::GetStdHandle(STD_OUTPUT_HANDLE); ::DWORD written; ::WriteConsoleW( _out, text, std::wcslen(text), &written, nullptr ); } int main(int argc, const char** argv) { output_swap swap; draw_text(L"┏━━━━━━━━━━━━━━━━━┓\n"); draw_text(L"┃ OK ┃\n"); draw_text(L"┗━━━━━━━━━━━━━━━━━┛\n"); return 0; } Also check you console font, in the console settings. You are probably need a raster font, but this is also working for Consolas for example. If you need console io streams, which can work with unicode as well as box driwing you can use my library

Related questions

0 votes
    I'm creating small engine/framework for making games. It's kind of simple question but I haven't ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    // merge.cpp // merges two containers into a third #include #include //for merge() using namespace std; int src1[] = { 2, 3, 4, ... , src1+5, src2, src2+3, dest); for(int j=0; j...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    The text box command of the drawing group is used to insert text. true or false Select the correct answer from above options...
asked Dec 27, 2021 in Education by JackTerrance
0 votes
    The text box command of the drawing group is used to insert text. true or false Select the correct answer from above options...
asked Dec 26, 2021 in Education by JackTerrance
0 votes
    In a simple linear regression model (One independent variable), If we change the input variable by 1 unit. How ... of R Programming Select the correct answer from above options...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    I have a JSON File with database environment configuration called env-config.json like this: { "LATEST":{ ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    I am trying to generate 10,000 unique random integers in the range of 1 to 20,000 to store in a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    I am trying to generate 10,000 unique random integers in the range of 1 to 20,000 to store in a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 10, 2022 in Education by JackTerrance
0 votes
    I want to store the hex values into a string, but I don't know to do that when my string is not giving me the ... using namespace std; int main(){ string s2 = "HelloWorld"; cout...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I want to store the hex values into a string, but I don't know to do that when my string is not giving me the ... using namespace std; int main(){ string s2 = "HelloWorld"; cout...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I've just started writing unit tests for a legacy code module with large physical dependencies using the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: How to concatenate a std::string and an int (24 answers) Closed 5 years ago. int i = 4; string text = "Player "; cout...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    I've just started writing unit tests for a legacy code module with large physical dependencies using the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    I doubt it can be done portably, but are there any solutions out there? I think it could be done ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 20, 2022 in Education by JackTerrance
...