Click here to Skip to main content
15,887,267 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: File Sharing (not) Pin
David Crow1-Jul-09 7:18
David Crow1-Jul-09 7:18 
GeneralRe: File Sharing (not) Pin
Caslen1-Jul-09 21:54
Caslen1-Jul-09 21:54 
GeneralRe: File Sharing (not) Pin
David Crow2-Jul-09 3:55
David Crow2-Jul-09 3:55 
GeneralRe: File Sharing (not) Pin
Caslen2-Jul-09 5:15
Caslen2-Jul-09 5:15 
QuestionRe: File Sharing (not) Pin
David Crow2-Jul-09 5:18
David Crow2-Jul-09 5:18 
AnswerRe: File Sharing (not) Pin
Caslen2-Jul-09 5:30
Caslen2-Jul-09 5:30 
GeneralRe: File Sharing (not) Pin
David Crow2-Jul-09 5:33
David Crow2-Jul-09 5:33 
QuestionClass Template in Visual C++ Pin
emira671-Jul-09 4:32
emira671-Jul-09 4:32 
Hello,

I formed class template that represent two dimensional array :

template<class T>
class Array2D {
protected:  

public:
      T *data;

        const unsigned rows, cols, size;
        Array2D(unsigned r, unsigned c) : rows(r), cols(c), size(r*c) {

      data = new T[size];
        }
        ~Array2D() { delete data; }
        void setValue(unsigned row, unsigned col, T value) { 
                data[(row*cols)+col] = value;
        }
        T getValue(unsigned row, unsigned col) const {
                return data[(row*cols)+col];
        }
};


And one dimensional data array is present:

array<double>^ input={20,4,6,15,7,2,1,8,9};



I have function it's inputs are class template and one dimensional data array.I set one dimensional array values to class template :

void function(Array2d<double> &x,array< double>^ input,int width,int,height)
{


double temp;
temp1=0;

double temp2;

int i,j;

// assign input array values to two dimensional array
for(i=0;i<width;i++)
for(j=0;j<height;j++)
{
{ temp2=input[temp1];
  x.setvalue(i,j,temp2);
  temp1=temp1+1;
}
}

}



After all I declared 3x3 class template:

Array2D<double>A(3,3);


I sent it to function:
function(A,input,3,3);


And I tried to print Array2D values:

double temp;
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
{temp=A.getValue(i,j)

Console:Write("{0}",temp);}}



I executed this applicaiton in CLR Application in Visual Studio 2008 amd it worked .But I want to implement this code on Windows Form Application,and it gave error like these on Form Application:

error C2065: 'Array2D' : undeclared identifier
error C2065: 'A' : undeclared identifier


How can I overcome this error or where should I locate class template?

Best Regards...
AnswerRe: Class Template in Visual C++ Pin
led mike1-Jul-09 4:40
led mike1-Jul-09 4:40 
AnswerRe: Class Template in Visual C++ Pin
David Crow1-Jul-09 4:47
David Crow1-Jul-09 4:47 
AnswerRe: Class Template in Visual C++ Pin
Stuart Dootson1-Jul-09 4:58
professionalStuart Dootson1-Jul-09 4:58 
Questiondll function call in vc++2008 clr bse apllication Pin
PIYUSH19661-Jul-09 4:08
PIYUSH19661-Jul-09 4:08 
QuestionRe: dll function call in vc++2008 clr bse apllication Pin
led mike1-Jul-09 4:35
led mike1-Jul-09 4:35 
QuestionDownload from Rapidshare! Pin
Hadi Dayvary1-Jul-09 3:49
professionalHadi Dayvary1-Jul-09 3:49 
QuestionMFC CSocket class! Pin
Hadi Dayvary1-Jul-09 3:47
professionalHadi Dayvary1-Jul-09 3:47 
AnswerRe: MFC CSocket class! Pin
led mike1-Jul-09 4:28
led mike1-Jul-09 4:28 
GeneralRe: MFC CSocket class! Pin
Hadi Dayvary1-Jul-09 5:16
professionalHadi Dayvary1-Jul-09 5:16 
GeneralRe: MFC CSocket class! Pin
led mike1-Jul-09 5:39
led mike1-Jul-09 5:39 
GeneralRe: MFC CSocket class! [modified] Pin
Moak18-Jul-09 4:36
Moak18-Jul-09 4:36 
GeneralRe: MFC CSocket class! Pin
Hadi Dayvary18-Jul-09 5:14
professionalHadi Dayvary18-Jul-09 5:14 
QuestionChange dialog bg-color? Pin
bosfan1-Jul-09 3:35
bosfan1-Jul-09 3:35 
AnswerRe: Change dialog bg-color? Pin
SandipG 1-Jul-09 4:15
SandipG 1-Jul-09 4:15 
GeneralRe: Change dialog bg-color? [modified] Pin
bosfan1-Jul-09 4:35
bosfan1-Jul-09 4:35 
GeneralRe: Change dialog bg-color? Pin
«_Superman_»1-Jul-09 16:46
professional«_Superman_»1-Jul-09 16:46 
GeneralRe: Change dialog bg-color? Pin
bosfan1-Jul-09 21:33
bosfan1-Jul-09 21:33 

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.