Click here to Skip to main content
15,891,019 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionJPEG to Cur Conversion Pin
ForNow15-May-10 17:07
ForNow15-May-10 17:07 
AnswerRe: JPEG to Cur Conversion Pin
Code-o-mat16-May-10 0:19
Code-o-mat16-May-10 0:19 
GeneralRe: JPEG to Cur Conversion Pin
ForNow16-May-10 7:10
ForNow16-May-10 7:10 
GeneralRe: JPEG to Cur Conversion Pin
Code-o-mat16-May-10 8:38
Code-o-mat16-May-10 8:38 
GeneralRe: JPEG to Cur Conversion Pin
ForNow16-May-10 8:51
ForNow16-May-10 8:51 
GeneralRe: JPEG to Cur Conversion Pin
Code-o-mat16-May-10 11:47
Code-o-mat16-May-10 11:47 
GeneralRe: JPEG to Cur Conversion --- Awicons did the trick Pin
ForNow16-May-10 8:35
ForNow16-May-10 8:35 
QuestionSolved - Two-Dimensional Array not reading right [modified] Pin
Frank Robertson15-May-10 16:20
Frank Robertson15-May-10 16:20 
Yes, It's me again Smile | :)

Okay, trying to store 5 cards into a two dimensional array.

Got handBoard[13][4] initialized to all 0's

hand[0] through hand[4] each are holding a random number between 0 and 51.

When I try to populate the two-dimensional array to show the five cards, I get random sections of the array sprouting 1's I didn't specify. Here is the section of the code that should be populating my array.


<code>
for (count = 0; count < 5; count++)
{
if (hand[count] < 13)
handColumn[count] = 0;
else if (( hand[count] > 13) && (hand[count] < 26))
handColumn[count] = 1;
else if ((hand[count] > 26) && (hand[count] < 39))
handColumn[count] = 2;
else if (39 < hand[count])
handColumn[count] = 3;
}
// setting which column the hand goes into

for (count = 0; count < 5; count++)
{
if ((hand[count] == 0) || (hand[count] == 13) || (hand[count] == 26) || (hand[count] == 39))
handRow[count] = 0;
else if ((hand[count] == 1) || (hand[count] == 14) || (hand[count] == 27) || (hand[count] == 40))
handRow[count] = 1;
else if ((hand[count] == 2) || (hand[count] == 15) || (hand[count] == 28) || (hand[count] == 41))
handRow[count] = 2;
else if ((hand[count] == 3) || (hand[count] == 16) || (hand[count] == 29) || (hand[count] == 42))
handRow[count] = 3;
else if ((hand[count] == 4) || (hand[count] == 17) || (hand[count] == 30) || (hand[count] == 43))
handRow[count] = 4;
else if ((hand[count] == 5) || (hand[count] == 18) || (hand[count] == 31) || (hand[count] == 44))
handRow[count] = 5;
else if ((hand[count] == 6) || (hand[count] == 19) || (hand[count] == 32) || (hand[count] == 45))
handRow[count] = 6;
else if ((hand[count] == 7) || (hand[count] == 20) || (hand[count] == 33) || (hand[count] == 46))
handRow[count] = 7;
else if ((hand[count] == 8) || (hand[count] == 21) || (hand[count] == 34) || (hand[count] == 47))
handRow[count] = 8;
else if ((hand[count] == 9) || (hand[count] == 22) || (hand[count] == 35) || (hand[count] == 48))
handRow[count] = 9;
else if ((hand[count] == 10) || (hand[count] == 23) || (hand[count] == 36) || (hand[count] == 49))
handRow[count] = 10;
else if ((hand[count] == 11) || (hand[count] == 24) || (hand[count] == 37) || (hand[count] == 50))
handRow[count] = 11;
else if ((hand[count] == 12) || (hand[count] == 25) || (hand[count] == 38) || (hand[count] == 51))
handRow[count] = 12;
}
// setting which column the hand goes into

for(count = 0; count < 5; count++)
handBoard[handColumn[count]][handRow[count]] = 1;

for(count = 0; count < 13; count++)
cout << handBoard[0][count] << ' ';
cout << endl;
for(count = 0; count < 13; count++)
cout << handBoard[1][count] << ' ';
cout << endl;
for(count = 0; count < 13; count++)
cout << handBoard[2][count] << ' ';
cout << endl;
for(count = 0; count < 13; count++)
cout << handBoard[3][count] << ' ';
cout << endl;
// printing out the array to see if it populates correctly.
</code>

This has been the biggest headache ever. Please, any help?



-- Modified Sunday, May 16, 2010 12:27 PM
AnswerRe: Two-Dimensional Array not reading right PinPopular
Luc Pattyn15-May-10 17:36
sitebuilderLuc Pattyn15-May-10 17:36 
GeneralRe: Two-Dimensional Array not reading right Pin
Frank Robertson15-May-10 19:30
Frank Robertson15-May-10 19:30 
GeneralRe: Two-Dimensional Array not reading right Pin
Luc Pattyn16-May-10 1:07
sitebuilderLuc Pattyn16-May-10 1:07 
GeneralRe: Two-Dimensional Array not reading right Pin
Frank Robertson17-May-10 13:00
Frank Robertson17-May-10 13:00 
GeneralCongrats Pin
Luc Pattyn17-May-10 13:11
sitebuilderLuc Pattyn17-May-10 13:11 
GeneralRe: Two-Dimensional Array not reading right Pin
Iain Clarke, Warrior Programmer16-May-10 20:49
Iain Clarke, Warrior Programmer16-May-10 20:49 
AnswerRe: Two-Dimensional Array not reading right Pin
Aescleal15-May-10 22:42
Aescleal15-May-10 22:42 
GeneralRe: Two-Dimensional Array not reading right Pin
Frank Robertson16-May-10 0:51
Frank Robertson16-May-10 0:51 
QuestionLinux commands Pin
TTPadmin15-May-10 12:07
TTPadmin15-May-10 12:07 
AnswerRe: Linux commands Pin
markkuk15-May-10 12:17
markkuk15-May-10 12:17 
GeneralRe: Linux commands Pin
TTPadmin15-May-10 12:29
TTPadmin15-May-10 12:29 
GeneralRe: Linux commands Pin
CPallini15-May-10 12:39
mveCPallini15-May-10 12:39 
AnswerRe: Linux commands Pin
Paul M Watt15-May-10 20:24
mentorPaul M Watt15-May-10 20:24 
GeneralRe: Linux commands Pin
TTPadmin17-May-10 12:12
TTPadmin17-May-10 12:12 
GeneralRe: Linux commands Pin
TTPadmin19-May-10 12:19
TTPadmin19-May-10 12:19 
QuestionInteracting with a 3rd party application dialog window Pin
Still learning how to code15-May-10 11:55
Still learning how to code15-May-10 11:55 
AnswerRe: Interacting with a 3rd party application dialog window Pin
Paul M Watt15-May-10 20:37
mentorPaul M Watt15-May-10 20:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.