HHHHEEEEELLLLPPPPPP!!!
-
hello, i need a matrix!!! but i have no const int values. my values are all int (because the values changed inside the programm). is there a possibility to make a two dimensional array (int array[n][m]) without const int values???? MFC
-
hello, i need a matrix!!! but i have no const int values. my values are all int (because the values changed inside the programm). is there a possibility to make a two dimensional array (int array[n][m]) without const int values???? MFC
You must have one of the dimentions fixed, i bealive :~ use the operator "new" Casa.Sapo.pt
-
hello, i need a matrix!!! but i have no const int values. my values are all int (because the values changed inside the programm). is there a possibility to make a two dimensional array (int array[n][m]) without const int values???? MFC
-
You can possibly try a vector inside a vector, or a list of vectors, but your going to need VC++ 7, as I think templated templates are new to VC++. Then again you could try Perl. It lets you do it.
No, you can do a vector of vectors in VC6. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
-
hello, i need a matrix!!! but i have no const int values. my values are all int (because the values changed inside the programm). is there a possibility to make a two dimensional array (int array[n][m]) without const int values???? MFC
What makes you think they need to be constant values ? Or do you mean for the dimensions ? Do this: int ** ppInt = new int[nRows]; for (int i = 0; i < nRows; ++i) ppInt[i] = new int[nCols]; Now you can reference each element as ppInt[x][y] ( unless I got rows and columns the wrong way around, which I am want to do ). As has been said, a vector of vectors is a better solution in terms of memory management, but if it were me, I'd probaby write a matrix class which wraps a int ** and does common matrix manipulations for me. Or search the web for one. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
-
What makes you think they need to be constant values ? Or do you mean for the dimensions ? Do this: int ** ppInt = new int[nRows]; for (int i = 0; i < nRows; ++i) ppInt[i] = new int[nCols]; Now you can reference each element as ppInt[x][y] ( unless I got rows and columns the wrong way around, which I am want to do ). As has been said, a vector of vectors is a better solution in terms of memory management, but if it were me, I'd probaby write a matrix class which wraps a int ** and does common matrix manipulations for me. Or search the web for one. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
thanks for reply. yes, you are right, i mean the dimensions as constant values. my compiler has problems with
int ** ppInt = new int[nRows];
. error: int* cannot convert in int** and withppInt[i] = new int[nCols];
. error: int* cannot convert in int what´s wrong? nRows and nCols are integers in my program. MFC -
thanks for reply. yes, you are right, i mean the dimensions as constant values. my compiler has problems with
int ** ppInt = new int[nRows];
. error: int* cannot convert in int** and withppInt[i] = new int[nCols];
. error: int* cannot convert in int what´s wrong? nRows and nCols are integers in my program. MFCMFC is the Best wrote: ppInt[i] = new int[nCols];. try ppInt[i] = new int*[ncols]; -c
No matter how fast light travels it finds the darkness has always got there first, and is waiting for it. -- Terry Pratchett,
-
You can possibly try a vector inside a vector, or a list of vectors, but your going to need VC++ 7, as I think templated templates are new to VC++. Then again you could try Perl. It lets you do it.
-
No, you can do a vector of vectors in VC6. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002