Jump to content
  • Advertisement

Archived

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

NewbJ

Underlining characters?

This topic is 5176 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!