In a C++ program, I have named some controls as such:
IDC_BTN1, IDC_BTN2, IDC_BTN3, IDC_BTN4...
But my board (Tic Tac Toe) that I process is a multidimensional array, so IDC_BTN2 would be [1][2] etc. I am using a loop as like below to input data into these controls, from the multidimensional array, into the buttons.
for ( x=1; x<=setsize; x++ ) {
for ( int y=1; y<=setsize; y++ ) {
}
}
To manage this I will need to use the two coordinates of the array, to come up with the number that the buttons are (I have em stored in a array). So from the numbers 1 and 2, i need to get the number 2, and the numbers 3 and 2, i need to get the number 12 and so on. How will i do this, any formula anyone knows of?
If such a formula doesn't exist, can anyone suggest an equally practical way to achieve this?
Question
justin89h
In a C++ program, I have named some controls as such:
IDC_BTN1, IDC_BTN2, IDC_BTN3, IDC_BTN4...
But my board (Tic Tac Toe) that I process is a multidimensional array, so IDC_BTN2 would be [1][2] etc. I am using a loop as like below to input data into these controls, from the multidimensional array, into the buttons.
for ( x=1; x<=setsize; x++ ) { for ( int y=1; y<=setsize; y++ ) { } }To manage this I will need to use the two coordinates of the array, to come up with the number that the buttons are (I have em stored in a array). So from the numbers 1 and 2, i need to get the number 2, and the numbers 3 and 2, i need to get the number 12 and so on. How will i do this, any formula anyone knows of?
If such a formula doesn't exist, can anyone suggest an equally practical way to achieve this?
Link to comment
Share on other sites
0 answers to this question
Recommended Posts