Symbols

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?
3 is the ASCII code for the heart symbol. Check an ASCII chart for the ohm char. You can just google ASCII Chart
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 ( ŕ )
Try using an unsigned char.
nope, results are still same =(
Depends on your font probably.

windows? dos?

1
2
http://en.wikipedia.org/wiki/Ascii
http://en.wikipedia.org/wiki/ISO/IEC_8859-1#ISO-8859-1 
@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?
I can't believe it...
CAN'T ANYONE HELP?
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 )
I still don't get it xD =SS
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
TNX m8!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Hey! I don't see Ohm character anywhere =(
Oh yeah, some chars are empty too???
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
roflmao
I find it hard to believe there isn't Ohm character...
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
Topic archived. No new replies allowed.