Archived

This topic is now archived and is closed to further replies.

NewbJ

Underlining characters?

Recommended Posts

NewbJ    226
Outputting to the console, is it possible to underline characters or get a line under them? I''m working on a very basic tic-tac-toe game, and when I output the board, I can use "|" characters to form the vertical column lines, but I don''t know how to form the horizontal row lines. Thanks!

Share this post


Link to post
Share on other sites
Oluseyi    2103
You can''t underline characters in the console because there are no underlined characters in the ASCII set. However, there are border characters (single- and double-line): ASCII 179 - 218. Try using those.

Don''t know how to specify arbitrary ASCII characters be printed? You can cast the integer value to char, or specify the code in hex or octal and pass it to an output routine as a char/char * string:

cout << (char)179;
cout << (char)0xb3;
cout << (char)0263;
All of the preceding print the same character: ³.

Share this post


Link to post
Share on other sites
CautionMan    122
www.asciitable.com has a listing of all the ASCII characters, and their corresponding hex, decimal, and octal values.

Or, if you''re feeling lazy, there''s always the old...


+-+-+-+
|x|x|o|
+-+-+-+
|x|o|x|
+-+-+-+
|o|x|o|
+-+-+-+

Share this post


Link to post
Share on other sites