Click here to Skip to main content
15,922,427 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralTemplate and operator Pin
Vics3-Jan-08 0:53
Vics3-Jan-08 0:53 
GeneralRe: Template and operator Pin
CPallini3-Jan-08 2:08
mveCPallini3-Jan-08 2:08 
GeneralRe: Template and operator Pin
Vics3-Jan-08 2:49
Vics3-Jan-08 2:49 
Questionhow to modify these matrix? Pin
gentleguy3-Jan-08 0:39
gentleguy3-Jan-08 0:39 
AnswerRe: how to modify these matrix? [modified] Pin
CPallini3-Jan-08 0:57
mveCPallini3-Jan-08 0:57 
QuestionRe: how to modify these matrix? Pin
David Crow3-Jan-08 2:58
David Crow3-Jan-08 2:58 
GeneralRe: how to modify these matrix? Pin
CPallini3-Jan-08 3:18
mveCPallini3-Jan-08 3:18 
GeneralRe: how to modify these matrix?[modifed 4/01/08] Pin
gentleguy3-Jan-08 14:43
gentleguy3-Jan-08 14:43 
dear all

actually i had finished this case, but i would like to brief this code, so after tried, but couldn't.the orignal code is here, anyone can brief it? thanks..


int main()
{
int number;


double a [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a2 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a3 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a4 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a5 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a6 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a7 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a8 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a9 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a10 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};

for (int number = 1; number <= 10; number ++)
{
cout << setw(4) << number << endl;
printArray(a);
}
number ++;



cout << setw(6) << "\na1:" << endl;
printArray(a1);
cout << endl;
cout << setw(6) << "\na2:" << endl;
printArray(a2);
cout << endl;
cout << setw(6) << "\na3:" << endl;
printArray(a3);
cout << endl;
cout << setw(6) << "\na4:" << endl;
printArray(a4);
cout << endl;
cout << setw(6) << "\na5:" << endl;
printArray(a5);
cout << endl;
cout << setw(6) << "\na6:" << endl;
printArray(a6);
cout << endl;
cout << setw(6) << "\na7:" << endl;
printArray(a7);
cout << endl;
cout << setw(6) << "\na8:" << endl;
printArray(a8);
cout << endl;
cout << setw(6) << "\na9:" << endl;
printArray(a9);
cout << endl;
cout << setw(6) << "\na10:" << endl;
printArray(a10);
cout << endl;

return 0;

}

void printArray(double a[3][4])
{

for ( int i =0; i< 3; i++)
{
for (int j = 0; j < 4; j++)
cout <<setw(10) << setprecision(6) << setiosflags(ios::fixed|ios::showpoint) << a[i][j] << setw(10) ;
cout << endl;
}
}

from above code, i can obtain 10 3x4 random real number matrix, but i need to brief it.

thanks a lot in advance

Li Zhiyuan

4/01/2008

GeneralRe: how to modify these matrix?[modifed 4/01/08] Pin
David Crow3-Jan-08 15:50
David Crow3-Jan-08 15:50 
GeneralRe: how to modify these matrix?[modifed 4/01/08] Pin
CPallini3-Jan-08 20:59
mveCPallini3-Jan-08 20:59 
AnswerRe: how to modify these matrix? Pin
David Crow3-Jan-08 2:47
David Crow3-Jan-08 2:47 
AnswerRe: how to modify these matrix? Pin
Randor 3-Jan-08 6:51
professional Randor 3-Jan-08 6:51 
GeneralRe: how to modify these matrix? Pin
CPallini3-Jan-08 7:23
mveCPallini3-Jan-08 7:23 
GeneralRe: how to modify these matrix? Pin
Randor 3-Jan-08 7:33
professional Randor 3-Jan-08 7:33 
GeneralRe: how to modify these matrix? Pin
CPallini3-Jan-08 7:52
mveCPallini3-Jan-08 7:52 
GeneralRe: how to modify these matrix? Pin
gentleguy3-Jan-08 14:36
gentleguy3-Jan-08 14:36 
GeneralA project made from XPCOM components and VC++ - I posted this messaje before several hours ago Pin
cuesdean florin3-Jan-08 0:38
cuesdean florin3-Jan-08 0:38 
QuestionRe: A project made from XPCOM components and VC++ - I posted this messaje before several hours ago Pin
Matthew Faithfull3-Jan-08 1:02
Matthew Faithfull3-Jan-08 1:02 
GeneralRe: A project made from XPCOM components and VC++ - I posted this messaje before several hours ago Pin
cuesdean florin3-Jan-08 1:34
cuesdean florin3-Jan-08 1:34 
GeneralRe: A project made from XPCOM components and VC++ - I posted this messaje before several hours ago Pin
Matthew Faithfull3-Jan-08 1:56
Matthew Faithfull3-Jan-08 1:56 
GeneralRe: A project made from XPCOM components and VC++ - I posted this messaje before several hours ago Pin
cuesdean florin3-Jan-08 4:10
cuesdean florin3-Jan-08 4:10 
GeneralRe: A project made from XPCOM components and VC++ - I posted this messaje before several hours ago Pin
Matthew Faithfull3-Jan-08 4:19
Matthew Faithfull3-Jan-08 4:19 
GeneralRe: A project made from XPCOM components and VC++ - I posted this messaje before several hours ago Pin
Jeremy Falcon3-Jan-08 6:17
professionalJeremy Falcon3-Jan-08 6:17 
GeneralRe: A project made from XPCOM components and VC++ - I posted this messaje before several hours ago Pin
Maxwell Chen3-Jan-08 16:15
Maxwell Chen3-Jan-08 16:15 
Generalchar* and unsigned int Pin
CodingLover3-Jan-08 0:26
CodingLover3-Jan-08 0:26 

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.