This is the first time for asking a question for help - usually if I agonize enough a solution comes to me but I just can't get my head around this so...


I have a array consisting of numbers that needs to be printed out in to a text file with a set number of numbers per line.

ie I want to split up the array:

array: 12345123451234512345

to:

12345
12345
12345
12345

I can do this easily just by printing to the file up till the correct line length (5) and then inserting a "\n" and starting a new line.

Now I want to essentially rotate the values by 90 degrees:

5555
4444
3333
2222
1111

I want every 5th value in the array to be printed on the first line, every 4th value on the 2nd line etc until the 1st value are printed on the 5th line.

As I said I just can't seem to get my head around a neat way of doing this. I am sure the answer will be obvious :-)

Does anyone have any suggestions?

Thanks for any help offered.

Kind Regards,

tony
_______________________________________________________
Dr. Anthony P. Scott,
Computational Quantum Chemistry Gp,     Office Ph.:     61-2-6125-3573
Research School of Chemistry,           Dept. Ph.:      61-2-6125-3637
Australian National University,                 Fax:                    61-2-6125-0750
Canberra, ACT 0200,                             
AUSTRALIA.

E-mail:         [EMAIL PROTECTED]
_______________________________________________________



Reply via email to