• ### Announcements

#### Archived

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

# 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 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 on other sites
Oluseyi    2103
Uh... That''s not the right character. Unicode entities do not coincide with ASCII for the extended ASCII set. My bad.

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