I want to print a box using special characters like this
cout << "╔═══╗" << endl;
cout << "║ ║" << endl;
cout << "║ ║" << endl;
cout << "╚═══╝" << endl;
but it displays like this
?????
? ?
? ?
?????
How can I fix this?
You could try this one:
cout << (char)201 << (char)205 << (char)187 << endl;
cout << (char)186 << " " << (char)186 << endl;
cout << (char)186 << " " << (char)186 << endl;
cout << (char)200 << (char)205 << (char)188 << endl;
I tested it and prints what you want
Find out what character set the terminal you are viewing the program output on is using, then use escape codes to put those characters in your strings
There are several types and editor you are programming with may be using a different kind the program displays with.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.