|
-
June 6th, 1999, 11:37 AM
#1
Program of n-potency of a matrix. Help!!!!!!!
I had a little problem with my code, I'm a beginer, i can make the multiplicatión but i can't get the n-potency
this is part of my code. What's wrong ?
cout<<"Givme the potency: ";
cin>>potency;
/*MAKE ANOTHER MATRIX TO MULTIPLICATION*/
for(int cont9=0; cont9<nodos; cont++)
for(int cont10=; cont10<nodos; cont10++)
{
Mnew [ cont9][cont10]=matriz[cont1][cont2]
}
/*MULTIPLICATION*/
for(int k=0; k<potency; k++)
{
for(int cont11=0; cont11<nodos; cont11++)
for(int cont12=0; cont12<nodos; cont12++)
{
suma=0;
for(int z=0; z<nodos; z++)
suma+=matriz[cont11][z]*Mnueva[z][cont12];
if (suma>=1)suma=1;
Mmul[cont11][cont12]=suma;
}
/*ASIGN RESULT IN A NEW MATRIX*/
for(int cont13=0; cont13<nodos; cont13++)
for(int cont14=0; cont14<nodos; cont14++)
{
Mnueva[cont13][cont14]=Mmul[cont13][cont14];
}
/*DISPLAY MATRIX IN SCREEN*/
clscr();
for(int cont15=0; cont15<nodos; cont15++)
for(int cont16=0; cont16<nodos; cont16++)
{
gotoxy((cont15+1)*2,(cont16+1)*2);
cout<<Mnueva[cont15][cont16];
}
getch();
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|