Need to print two column of numbers (integers) with same width, with 1st column left aligned and 2nd column right aligned. Can someone help me?
1 解答
链接已复制
5 回复数
Something like :
character(widthRequired) leftString integer firstNumber integer secondNumber write(leftString, *) firstNumber leftString = adjustl(leftString) write(outputfile,fmt) leftString, secondNumber
where fmt is say (A10, I10) and "10" is the widthRequired.
Hope this helps but you should look up ADJUSTL (and maybe ADJUSTR) in the help
Les
Thank you Les!
I was trying out only with numbers and the string conversion worked for me.
nvaneck wrote:
Or,
Write (outputfile,'(I0,T10,I10) n1,n2
I had totally forgotten about format i0 I spend most of my life in C# now. Punishment but I don't know what I did wrong. :-)
nvaneck wrote:
Or,
Write (outputfile,'(I0,T10,I10) n1,n2
Most simplest form. Thank you!
