Symbols

Feb 12, 2009 at 7:04pm
When I wrote my Blackjack program I used char A=3,B=4,C=5,D=6; so that A is heart, B is diamond and so on...
I don't know why char 3 is equal to heart I just saw it in another poker program =P
Can anyone explain me pls and say me which char is used for ohm?
Feb 12, 2009 at 7:19pm
3 is the ASCII code for the heart symbol. Check an ASCII chart for the ohm char. You can just google ASCII Chart
Feb 12, 2009 at 8:26pm
I tried (duh xD)
On this site ( http://www.asciitable.com/ ) you can read that ohm is 234.
But when I try to output it on my monitor I get some weird letter ( ŕ )
Feb 12, 2009 at 9:26pm
Try using an unsigned char.
Feb 12, 2009 at 9:51pm
nope, results are still same =(
Feb 12, 2009 at 10:12pm
Depends on your font probably.

windows? dos?

Feb 12, 2009 at 10:36pm
1
2
http://en.wikipedia.org/wiki/Ascii
http://en.wikipedia.org/wiki/ISO/IEC_8859-1#ISO-8859-1 
Feb 13, 2009 at 3:20pm
@Smook006
Tnx but it didn't help...

@jsmith
I'm using Windows Xp SP2 but I don't I don't think it makes any difference... And doesn't C++ use always the default font if you don't modify it in the code?
Feb 14, 2009 at 1:36pm
I can't believe it...
CAN'T ANYONE HELP?
Feb 14, 2009 at 1:56pm
The symbols depend on the encoding http://www.cplusplus.com/doc/ascii.html

On my Windows Vista if I cout << '\xEA'; I get Û
if I ofstream f("text.txt"); f << '\xEA'; I get ê
( hexadecimal EA is the same as decimal 234 )


( C++ doesn't have any font )
Feb 14, 2009 at 2:19pm
I still don't get it xD =SS
Feb 14, 2009 at 2:38pm
Try this code:
1
2
for ( short s = 0; s<256; s++ )
   cout << char(s) << '\t' << s << '\n';
It will show you all the characters you can have on your console window
Feb 14, 2009 at 5:12pm
TNX m8!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Feb 14, 2009 at 5:35pm
Hey! I don't see Ohm character anywhere =(
Feb 14, 2009 at 5:36pm
Oh yeah, some chars are empty too???
Feb 14, 2009 at 5:50pm
There should be newline, carriage return space & other like those.

If you don't have a Ω, draw it
1
2
3
4
5
6
7
cout << "\x20\x20\xdb\xdb\xdb\xdb\x20\x20\n";
cout << "\x20\xdb\x20\x20\x20\x20\xdb\x20\n";
cout << "\xdb\x20\x20\x20\x20\x20\x20\xdb\n";
cout << "\xdb\x20\x20\x20\x20\x20\x20\xdb\n";
cout << "\x20\xdb\x20\x20\x20\x20\xdb\x20\n";
cout << "\x20\x20\xdb\x20\x20\xdb\x20\x20\n";
cout << "\xdb\xdb\xdb\x20\x20\xdb\xdb\xdb\n";
This will be a bit bigger than a single character...
Last edited on Feb 14, 2009 at 5:50pm
Feb 14, 2009 at 6:10pm
roflmao
I find it hard to believe there isn't Ohm character...
Feb 15, 2009 at 2:10pm
A char can have only 256 values so an encoding can't have all the characters.
Windows cmd doesn't display wchar_t (wide characters) so no Ω...
Last edited on Feb 15, 2009 at 2:10pm
Topic archived. No new replies allowed.