Sunday, July 13, 2008
My first post.. haha=D
Oki.. tis is da answer for SPROG lab7 qn5b..
Warning: it is friggin long.. n im too lazi to tink of a shorter method..
So som1 pls edit it to a shorter version oki? thx..
int main()
{
int element[8], result[4], count, num1, num2;
//input
num1=0;
num2=0;
for (; count<2;>> element[count];
num2++;
}
num1=1;
num2=0;
for (; count<4;>> element[count];
num2++;
}
cout << num1="0;" num2="0;">> element[count];
num2++;
}
num1=1;
num2=0;
for (; count<8;>> element[count];
num2++;
}
cout << endl;
//matrix
cout << "Matrix A is" << endl;
for (count=0; count<2; count++)
cout << element[count] << "\t\t";
cout << endl;
for (; count<4; count++)
cout << element[count] << "\t\t";
cout << "\n\nMatrix B is" << endl;
for (; count<6; count++)
cout << element[count] << "\t\t";
cout << endl;
for (; count<8; count++)
cout << element[count] << "\t\t";
//computation
num1=4;
num2=6;
for (count=0; count<2; count++)
{
result[count]= element[0]*element[num1] + element[1]*element[num2];
num1++;
num2++;
}
num1=4;
num2=6;
for (; count<4; count++)
{
result[count]= element[2]*element[num1] + element[3]*element[num2];
num1++;
num2++;
}
//output
cout << "\n\nResultant Matrix is" << endl;
for (count=0; count<2; count++)
cout << result[count] << "\t\t";
cout << endl;
for (; count<4; count++)
cout << result[count] << "\t\t";
return 0;
}
by marcus^.^
; tortured on 2:29 PM =/
__________________________________
the1B02
ONE class of FIFTEEN gentlemen and FIVE ladies
average age of SEVENTEEN
first met each other on 8th apr 08 at T1442
we are
environmental friendly
theCREWS
Designer: no idea
Code Edited: abigail/han sheng
Picture: photobucket
Host: blogger::
photobucket
Thanks: blogskins
click THIS: ♥
thecopyCATS
this blog was created by HANSHENG.
the templater was ABIGAIL.
blogskin found by JESSLE.
you are NOT ALLOWED to copy or take anything from HERE. trespassers WILL be prosecuted.