Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Printf
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===1950s: Fortran=== Early programming languages like [[Fortran]] used special statements with different syntax from other calculations to build formatting descriptions.<ref name="Sayre_1956">{{cite book |title=The FORTRAN Automatic Coding System for the IBM 704 EDPM: Programmer's Reference Manual |publisher=Applied Science Division and Programming Research Department, [[International Business Machines Corporation]] |location=New York, USA |date=October 15, 1956 |editor-first=David |editor-last=Sayre |editor-link=David Sayre |author-first1=John Warner |author-last1=Backus |author-link1=John Warner Backus |author-first2=R. J. |author-last2=Beeber |author-first3=Sheldon F. |author-last3=Best |author-first4=Richard |author-last4=Goldberg |author-first5=Harlan L. |author-last5=Herrick |author-first6=R. A. |author-last6=Hughes |author-first7=L. B. |author-last7=Mitchell |author-first8=Robert A. |author-last8=Nelson |author-first9=Roy |author-last9=Nutt |author-link9=Roy Nutt |author-first10=David |author-last10=Sayre |author-link10=David Sayre |author-first11=Peter B. |author-last11=Sheridan |author-first12=Harold |author-last12=Stern |author-first13=Irving |author-last13=Ziller |pages=26β30 |url=http://archive.computerhistory.org/resources/text/Fortran/102649787.05.01.acc.pdf |access-date=July 4, 2022 |url-status=live |archive-url=https://web.archive.org/web/20220704193549/http://archive.computerhistory.org/resources/text/Fortran/102649787.05.01.acc.pdf |archive-date=July 4, 2022}} (2+51+1 pages)</ref> In this example, the format is specified on line {{samp|601}}, and the {{code|PRINT|fortran}}{{efn|According to the 1956 Fortran manual{{r|Sayre_1956}}, the {{code|PRINT|fortran}} command prints on the attached [[line printer|printer]]. The manual also introduces the command {{code|WRITE OUTPUT TAPE|fortran}} that also uses the {{code|FORMAT|fortran}} statement to write on a [[Magnetic-tape data storage|tape unit]].}} command refers to it by line number: <syntaxhighlight lang="fortranfixed"> PRINT 601, IA, IB, AREA 601 FORMAT (4H A= ,I5,5H B= ,I5,8H AREA= ,F10.2, 13H SQUARE UNITS) </syntaxhighlight> Hereby: * {{code|4H|fortran}} indicates a [[String (computer science)|string]] of 4 [[character (computer science)|characters]] <code>" A= "</code> ({{code|H}} means [[Hollerith constant|Hollerith Field]]); * {{code|I5|fortran}} indicates an [[Integer (computer science)|integer]] field of width 5; * {{code|F10.2|fortran}} indicates a [[floating-point]] field of width 10 with 2 digits after the decimal point. An output with input arguments {{code|100}}, {{code|200}}, and {{code|1500.25}} might look like this: <syntaxhighlight lang="output"> A= 100 B= 200 AREA= 1500.25 SQUARE UNITS </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)