openSUSE Forums > Archives > SF Archives > ARCHIVES - Programming & Scripting » Is There A Way To Display Spade, Heart, Diamond Or Club Symbols In The

Go Back   openSUSE Forums > Archives > SF Archives > ARCHIVES - Programming & Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Programming & Scripting A place to discuss website design, programming, shell scripts, etc

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 22-Jan-2008, 18:50
Suser
Guest
 
Posts: n/a
Default

I'm writing a program that deals out a poker hand for my C++ programming class at school. It's not required that we use symbols; we can just use the words "spade," "heart," "diamond," and "club," but I want to display the actual symbols for these in the unix terminal, if that's possible. I know how to do it for a Windows machine, but is it possible in the Unix terminal? For a Windows command shell, you just have

char symbol = 0x03 for a heart, or char symbol = 0x04 for a diamond, etc... then cout << symbol. When I try to cout << symbol in my Linux console, it doesn't display anything.

If anyone could help, I'd appreciate that. I don't expect an exact answer, maybe someone could just point me in the right direction...
  #2 (permalink)  
Old 22-Jan-2008, 18:52
ken_yap
Guest
 
Posts: n/a
Default

You have to find the Unicode codes for those symbols and print the corresponding codes. Assuming your terminal is Unicode capable.
  #3 (permalink)  
Old 22-Jan-2008, 19:33
Suser
Guest
 
Posts: n/a
Default

Well I did find out that a simple copy and paste into emacs works. I have:
cout << ♠ ♣ ♥ ♦;
I didn't find out about the unicode yet, but I'll get to that.
  #4 (permalink)  
Old 22-Jan-2008, 19:39
ken_yap
Guest
 
Posts: n/a
Default

You are probably already using the Unicode in there. Cut and paste is perfectly valid way to solve this problem since you only need to output those symbols, not know the exact value of the codes.
  #5 (permalink)  
Old 22-Jan-2008, 19:48
Suser
Guest
 
Posts: n/a
Default

Wow, I solved the problem without knowing it. Great!
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2