I'm a beginner and using c++, i was wondering how do you create a space with an int variable in an array.
int Array[9][9] = {{ ' ', 0, 1 , 2 , 3, 4 ,5,6,7},{0,1,1,1,2,3,4,5,6},
{1,1,1,2,3,4,5,6,7},{2,1,2,2,3,4,5,6,7},
{3,2,3,3,3,5,6,7,8},{4,3,4,4,5,5,6,7,8},
{5,4,5,5,6,6,7,8,9},{6,5,6,6,7,7,8,8,9},
{7,6,7,7,8,8,9,9,9}};
As you can see at Array[0][0] i want make a space there. It comes out as 32.
so i tried converting it like this static_cast<char>(32) but it still doesn't work. Any ideas or advice?
Well i have 5 2d arrays. A,B,C,D and E. The answer that i get for B and C would go into D. As in int D[B][C]. So if i make the array a char then i wouldn't get the correct values. so if i make the array an int. I can just convert the 1st value to a space
I have an answer to a problem which links up at B[2][3] and C[3][4]
so that answer should go into the array D[B[2][3]][C[3][4]] but it wouldn't because it's turning everything to ascii values and the answers are coming out haywire
The answer that i get for B and C would go into D. As in int D[B][C]
You cant statically allocate an array using a variable holding a size, you would need to know its size in advance using that method. To make arrays during runtime you would need to dynamically allocate the memory using the new operator.
It's part of an exercise unfortunately. Like asking the user questions and for each question the get a mark. Then when i'm done with section A's question. I put the marks i got for the questions in the array A and get the answer. But the table i was given has a space in it