I have an array matrix A 5x5 and I have to use three matrixes to initialize A array. all data has to give user.
for example A array is
10 0 0 0 0
0 0 20 0 0
0 30 40 0 0
0 0 0 0 0
0 0 0 0 50
and this we can write as rows=[1,2,3,3,5], columns=[1,3,2,3,5], elements=[10,20,30,40,50]. Array elemnts dont have to use 0.
And now we have to add A and B arrays nxm which are saved in memory with a way i showed before. And the result is array C. C=A+B - ?
I'm not sure that I understand you.
Are you saying that the elements in array A are:
A[0][0]=10;
A[1][2]=20;
A[2][1]=30;
A[2][2]=40;
A[4][4]=50;
and that zero's can be disregarded?.........which I don't think is feasible because they will get 0 anyway.
If the above is true, presumably your B matrix will have some similar pattern and so the B array will have some similar pattern to the A array above.
So C array at each location will just contain the sum of each individual element in array A and array B at that location number.
e.g if:
B[1][2]=21;
C[1][2]=41;
Is the above correct or not?
ok... it wasn't exactly right, but the problem is that I don't have to give any numbers. they will give a user. So the program have to ask which elements wants user to give and where to put it. and all other elements will be 0. In the end array A and B have to add and the result is array C.