Help! I am writing a program that will simulate a card game, and was wondering if anyone knew the code to print out characters such as a heart, spade, etc. I copied them into the code as characters, but they print to the screen as question marks.
ASCII Characters
Page 1 of 15 Replies - 16581 Views - Last Post: 27 October 2006 - 06:42 AM
Replies To: ASCII Characters
#2
Re: ASCII Characters
Posted 26 October 2006 - 01:04 AM
//no_comment, on 25 Oct, 2006 - 07:42 PM, said:
Help! I am writing a program that will simulate a card game, and was wondering if anyone knew the code to print out characters such as a heart, spade, etc. I copied them into the code as characters, but they print to the screen as question marks.
the ability to print special characters is related to something called a "code page".
Try looking up MSDN for information
#3
Re: ASCII Characters
Posted 26 October 2006 - 08:19 AM
It is kinda of operating system dependant but you could use the following escape characters on Windows to get those symbols.
\3 and \4 and \5 and \6.
\3 and \4 and \5 and \6.
#4
Re: ASCII Characters
Posted 26 October 2006 - 07:57 PM
Thanks for all the help so far. I initialized an array of strings with 52 elements each containing the possible card number and suit. When I build it there are no errors, but when i attempt to debug, I receive an error message to the effect of null.reference.exception. Does anyone know what this means and how I can fix it. Here is my array:
I take that back, i just commented out some lines of code and it compiled correctly.
These are the arrays that will hold the cars for each player and the discard pile. Can anyone spot what is causing it to give me the null reference error? *When i stop initializing the arrays to zero, the problem dissapears also.
string card1[DECK]= {"1\3","2\3","3\3","4\3","5\3","6\3","7\3","8\3","9\3","J\3","Q\3","K\3","A\3",
"1\4" ,"2\4","3\4","4\4","5\4","6\4","7\4","8\4","9\4","J\4","Q\4","K\4","A\4",
"1\5" ,"2\5","3\5","4\5","5\5","6\5","7\5","8\5","9\5","J\5","Q\5","K\5","A\5",
"1\6" ,"2\6","3\6","4\6","5\6","6\6","7\6","8\6","9\6","J\3","Q\6","K\6","A\6"};
I take that back, i just commented out some lines of code and it compiled correctly.
string hand1[HAND]={0};
string hand2[HAND]={0};
string discard[DECK]={0};
These are the arrays that will hold the cars for each player and the discard pile. Can anyone spot what is causing it to give me the null reference error? *When i stop initializing the arrays to zero, the problem dissapears also.
This post has been edited by //no_comment: 26 October 2006 - 07:58 PM
#5
Re: ASCII Characters
Posted 26 October 2006 - 09:57 PM
These are strings and as such you need to initialize them this way:
string hand1[HAND]={""};
string hand2[HAND]={""};
string discard[DECK]={""};
#6
Re: ASCII Characters
Posted 27 October 2006 - 06:42 AM
I can't believe i forgot the quotes! Thanks so much for pointing that out.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|