Article View: comp.lang.misc
Article #1257Re: Lessons from Algol (Was: JLG's flogging of horses)
From: Tony Warnock
Date: Fri, 04 May 1990 19:13
Date: Fri, 04 May 1990 19:13
41 lines
1876 bytes
1876 bytes
In article <XT73_W7ggpc2@ficc.uu.net>, peter@ficc.uu.net (Peter da Silva) writes:
> > With respect to the C statement:
>
> > printf("The answer is %d, not %d\n", ans, resp)
>
> > one can use the following Fortran statement
>
> > write(*,*)' The answer is',ans,' not',resp
>
> Will this not pad the numbers "ans" and "resp" with spaces? Fortran I/O is
> heavily oriented towards columnar output, to the extent that it's all but
> impossible to avoid this.
> --
> `-_-' Peter da Silva. +1 713 274 5180. <peter@ficc.uu.net>
> 'U` Have you hugged your wolf today? <peter@sugar.hackercorp.com>
> @FIN Commercial solicitation *is* accepted by email to this address.
Fortran allows both tabulated and free form output. The
following program and associated output show the
formatting used by the default libraries at Los Alamos.
(Your milage may vary.)
PROGRAM test(tty,input=tty)
IMPLICIT INTEGER (a-z)
ans=5
resp=4
WRITE(*,*)' The answer is ',ans,'not ',resp
ans=5555555555
resp=4444444444
WRITE(*,*)' The answer is ',ans,'not ',resp
END
The answer is 5, not 4
The answer is 5555555555, not 4444444444
The Fortran standard allows for either commas or blanks
as separators for numerical list-directed output.
Character output has no separators.
Technical Details
Message-ID:
<14358@lambda.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!lanl!lambda!ttwReferences:
<1990Apr19.180903.27750@maths.nott.ac.uk> <4277@tukki.jyu.fi> <XT73_W7ggpc2@ficc.uu.net>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!lanl!lambda!ttw From: ttw@lambda.UUCP (Tony Warnock) Newsgroups: comp.lang.misc Subject: Re: Lessons from Algol (Was: JLG's flogging of horses) Summary: Re Fortran list-directed I/O Message-ID: <14358@lambda.UUCP> Date: 4 May 90 19:13:07 GMT References: <1990Apr19.180903.27750@maths.nott.ac.uk> <4277@tukki.jyu.fi> <XT73_W7ggpc2@ficc.uu.net> Lines: 41