Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://star.arm.ac.uk/f77to90/c4.html
Дата изменения: Sat Feb 17 19:41:00 1996 Дата индексирования: Mon Oct 1 20:58:16 2012 Кодировка: Поисковые слова: comet |
PROGRAM FORMAT IMPLICIT NONE REAL :: X CHARACTER (LEN=11) :: FORM1 CHARACTER (LEN=*), PARAMETER :: FORM2 = "( F12.3,A )" FORM1 = "( F12.3,A )" X = 12.0 PRINT FORM1, X, ' HELLO ' WRITE (*, FORM2) 2*X, ' HI ' WRITE (*, "(F12.3,A )") 3*X, ' HI HI ' ENDIn the PRINT statement we use the character string variable FORM1 with the length 11, which is assigned its value in an explicit assignment statement. The difficulty with this method is essentially that you have to count manually the number of characters, if it is too small the NAG compiler will not give a compilation error, but the error will show up at execution.
In the first WRITE statement we use instead a character string constant FORM2. The advantage is that with the PARAMETER statement it is not necessary to give an explicit length of the constant, but it can be given the length with the statement LEN=*. The bad thing is that we can not assign the constant a new value.
In the second WRITE statement we use directly an explicit character string. The difficulty is that the string can not be reused.
WRITE(*, "( HI )")Solution.
(4.2) What does the following statement perform?
CHARACTER (LEN=9) :: FILIP FILIP = '(1PG14.6)' WRITE(*,FILIP) 0.001, 1.0, 1000000.Solution.