
magic array
hi all...
I am trying to write an array matrix that will pull in a number that defines the array size of rows and cols (like #3 means 3 rows 3 cols)
and then wrap numbers around the matrix so that the sum diag, across and down are all equal
here is the #3 example:
8 1 6
3 5 7
4 9 2
the sum is 15.
supposedly the number 1 needs to be in the middle row of col 1.
and each successive int up one and over one.
I have been provided with an external file of 6 numbers each that are to be used to make a searate matrix.
I am totally lost.
My first 2d array program was before this and i could pull in data from an external file print as a matrix and like this arr[1][2]...
but i am completely at a loss as to where the other numbers
in the array come from...
the instructions are:
write a program that prints a magic cube as well as it's magic sum for an odd integer s greater than 1 but less than 17.
maybe the instuctions are vague or I am just stupid..I am not asking for anyone to do my homework i am asking for help understanding WHAT to do...
someone with experience out there MUST know what it's like to
look at a question and get a big ? in their head???
thanks a lot
Michele

I do not know of a mathematical shortcut. My solution is to create, for example, a 4x4 array and change the elements in the first 3 rolls and first 3 columns until you get the correct sum for all rolls, columns, and diagonals.
Kuphryn

algorythms
really?
i'll try...
what would it be called?
sorry, I am really green an feeling stupid
Michele

wow