A summary of the format output of Fortran

Source: Internet
Author: User
Tags control characters

put a piece of others summed up first:formatted output control characters are very rich, but often not much, generally speaking: "I, F, E, A, X" is the most commonly used in several formats, the mostAll right, write them down.

IW[.M]                            outputs an integer with a width of W characters, or at least a m number.

such as: Write (*, "(I5)") 100 Output: _ _100; front two spaces  

FW.D to output floating-point numbers in the W-character text box, the decimal part occupies the D-character justifies, and the Output text box setting does not appear in the * number.

such as: Write (*, "(F9.3)") 123.45 output: _ _123.450; Front two spaces, post-fill 0

Ew.d[ee] using scientific notation, the justifies of W characters to output floating-point numbers, fractional part of the D-word justifies, the exponential portion of the minimum output of e-numbers.

example: Write (*, "(E15.7)" 123.45 output: _ _0.1234500e+03; output not 15 characters in the blank, the fractional part is less than 7 bits will be 0

The dw.d is used in the same way as EW.D, except that the letters used to represent the exponent are converted from E to D in the output.  

Aw output A string with the W character justifies. Write (*, "(A10)") "Hello" fixed with is a word for 10 i Fu Gellai output string, insufficient front fill space

NX The output position moves to the right n bits. Write (*, "(5X,I3)") 100; 5 spaces are filled in before the integer is output.

Lw output The true and false values of T or F in W characters justifies. Write (*, "(L4)"). True. The program will output 3 spaces and a T

line-Wrapping output. Write (*, "(I3//3)") 10,10 program will draw 4 lines, the middle two lines of space is from division sign "/" GET.

The Tc moves the position of the output to the bank's C byte. TLn the output position to the left relative to move n bytes. TRn the output position to the left relative to move n bytes. SP, SS  , the output number is positive with "+" and the SS is used to cancel the SP function.                   such as write (*, "(SP, I5, I5, SS, I5)") 5, 5, 5 output:+5   +5   5 bn, BZ bn defines a byte that has no data at input to represent nothing. BZ defines a byte representing 0 in the absence of data Here is an example summary:1. FORMAT (5X, ' ****** ',/,5x, ' NON e* possibilie L estrapolazione DELIA curva MOT ') Result: 5 spaces ******

5 spaces non e* possibilie L estrapolazione DELIA Curva MOT

2. The H in fortran77 is used to denote the character count output *h ... Represents the * characters following the output H.

3, Format (5 (10F7.2/)), with parentheses to expand, preceded by a number, indicating that the format in parentheses repeats so many times. That is, n (XX) is equivalent to xx,xx,xx,xx .... Repeat n times.
4. The function of the newline slash (/) modifier is to end the record in our output and start outputting the next record from the next line. If there are two consecutive slashes, it is equivalent to adding an empty line output. If a slash appears at the end of the edit, a blank line is also output. With n consecutive slashes, you can achieve the output n-1 blank line effect.

Transferred from: http://blog.sina.com.cn/s/blog_b75af2530101gb2f.html

A summary of the format output of Fortran

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.