Click here to Skip to main content
15,910,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to set inlude of option? Pin
David Crow5-Jan-08 4:33
David Crow5-Jan-08 4:33 
JokeRe: how to set inlude of option? Pin
CPallini5-Jan-08 4:35
mveCPallini5-Jan-08 4:35 
GeneralRe: how to set inlude of option? Pin
gentleguy6-Jan-08 0:07
gentleguy6-Jan-08 0:07 
GeneralAVCODEC Pin
Girish Kumar4-Jan-08 22:24
Girish Kumar4-Jan-08 22:24 
GeneralConvert Date to EXCEL Numeric Pin
im_hoser4-Jan-08 21:10
im_hoser4-Jan-08 21:10 
GeneralRe: Convert Date to EXCEL Numeric Pin
CPallini5-Jan-08 0:50
mveCPallini5-Jan-08 0:50 
GeneralProbelm in calling ActiveX VB dll Pin
manoharbalu4-Jan-08 19:35
manoharbalu4-Jan-08 19:35 
Generalurgent help Pin
gentleguy4-Jan-08 19:22
gentleguy4-Jan-08 19:22 
dear all

the following is what i did, but it is smooth to compile, but after i seperate this code to two, one is header file, the other is cpp....output showed me:
fatal error C1083: Cannot open include file: 'Centroids.h': No such file or directory

so what happened? the seperate code is in second phase.


class Centroids
{

public:
void printArray(double a[3][4] )
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 4; j++)

cout << setw(3) << setprecision(6) << setiosflags(ios::fixed|ios::showpoint) << a[i][j] << " ";
cout << endl;

}

}
private:

double a[3][4];


};


int main()
{
Centroids matrix;
int number = 1;

for (int number = 1; number <=10; number++)
{

double a[3][4] = {{(double)rand()/RAND_MAX, (double)rand()/RAND_MAX, (double)rand()/RAND_MAX,( double)rand()/RAND_MAX},{(double)rand()/RAND_MAX,(double)rand()/RAND_MAX,(double)rand()/RAND_MAX,(double)rand()/RAND_MAX},{(double)rand()/RAND_MAX,(double)rand()/RAND_MAX,(double)rand()/RAND_MAX,(double)rand()/RAND_MAX}};

cout << setw(4) << number << endl;
matrix.printArray(a);
cout << endl;
}
number = number + 1;


return 0;
}



the following is seperate code:

cpp

void Centroids::oneCentroid(double a[3][4])
{

for (double i = 0; i < 3; i++)
{

for (double j = 0; j < 4; j++)

cout << setw(3) << setprecision(6) << setiosflags(ios::fixed|iso::showpoint) << a[i][j] << " ";
cout << endl;
}
}

int main()
{

Centroids matrix;
int number = 1;

for (number = 1; number <=10; number++)

{
double a[3][4] = {{(double)rand()/RAND_MAX, (double)rand()/RAND_MAX, (double)rand()/RAND_MAX,( double)rand()/RAND_MAX},{(double)rand()/RAND_MAX,(double)rand()/RAND_MAX,(double)rand()/RAND_MAX,(double)rand()/RAND_MAX},{(double)rand()/RAND_MAX,(double)rand()/RAND_MAX,(double)rand()/RAND_MAX,(double)rand()/RAND_MAX}};
cout << setw(4) << number << endl;
matrix.oneCentroid(a);
cout << endl;
}
number = number + 1;

return 0;

}

header file

class Centroids
{
public:
void oneCentroid(double [3][4]);

private:
double a[3][4];
};

thanks a lot

Li Zhiyuan

5/01/2008

QuestionRe: urgent help Pin
CPallini4-Jan-08 23:09
mveCPallini4-Jan-08 23:09 
GeneralRe: urgent help Pin
gentleguy5-Jan-08 1:20
gentleguy5-Jan-08 1:20 
GeneralRe: urgent help Pin
Joan M5-Jan-08 2:14
professionalJoan M5-Jan-08 2:14 
QuestionProblem with using SENS and the COM Event System in VC++ Pin
ashishbhatt4-Jan-08 17:40
ashishbhatt4-Jan-08 17:40 
GeneralRe: Problem with using SENS and the COM Event System in VC++ Pin
David Crow4-Jan-08 17:50
David Crow4-Jan-08 17:50 
GeneralRe: Problem with using SENS and the COM Event System in VC++ Pin
ashishbhatt4-Jan-08 18:12
ashishbhatt4-Jan-08 18:12 
QuestionHow to get local ip address Pin
shakumar_224-Jan-08 17:18
shakumar_224-Jan-08 17:18 
AnswerRe: How to get local ip address Pin
David Crow4-Jan-08 17:46
David Crow4-Jan-08 17:46 
AnswerRe: How to get local ip address Pin
Hamid_RT4-Jan-08 18:01
Hamid_RT4-Jan-08 18:01 
Generalupgrading dbghelp.dll Pin
DevMentor.org4-Jan-08 9:20
DevMentor.org4-Jan-08 9:20 
GeneralRe: upgrading dbghelp.dll Pin
DevMentor.org4-Jan-08 9:49
DevMentor.org4-Jan-08 9:49 
QuestionText height in CRichEditCtrl Pin
DougVC4-Jan-08 7:24
DougVC4-Jan-08 7:24 
GeneralRe: Text height in CRichEditCtrl Pin
CPallini4-Jan-08 7:36
mveCPallini4-Jan-08 7:36 
GeneralRe: Text height in CRichEditCtrl Pin
Mark Salsbery4-Jan-08 8:26
Mark Salsbery4-Jan-08 8:26 
QuestionNeed some idea or const way to do this? Pin
Hakan Bulut4-Jan-08 7:16
Hakan Bulut4-Jan-08 7:16 
GeneralRe: Need some idea or const way to do this? Pin
Maxwell Chen4-Jan-08 7:26
Maxwell Chen4-Jan-08 7:26 
QuestionRe: Need some idea or const way to do this? Pin
CPallini4-Jan-08 7:39
mveCPallini4-Jan-08 7:39 

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.