Vous êtes sur la page 1sur 34

! " !

# $ % &" '
())) !" *&+,-$ &+ -+% &! && .

• c *
• !

o
o !
• ! ! "
• # " $ %

& !
# $ '(

$ % & ''
) */ 01!+ , $ !* !- ( .
/&-&"" /& / program & & end
program nom
...
end
! !!$& ! subroutine end
subroutine nom (arguments)
...
end
. !* ! function end
type function nom (arguments)
...
end

& '' & &


/ - ,( ,
0 ( 1
!

%
0, , & /2 3 4

%
,( , 56 678 ,
( /
0 , / &
/ &

(
)&
/ . , / 3 / 9 $
/ , / / (0 $

8 3
! ( 3 /
: ' #

6 !

* !"

0 ( "!+

0 ,

: & !# !

2
# / ! ; .
/ / ) / , <1!. $!. 1 =
2
! / & -''' ; . 0>
/ & ?" " !! !. / 3 '/ ! $
@/ 1 ! A A !@
/ ,
B >&& & &
2 %
* !" ! $ & @
"! / ( / 1 C!. A A C!;
/ < " >&&
& &
2 % 4 5
7 / ! ! D /2
' -
E 2 ( / $ . ;$ !4. 0 F
%

3 #
.

'(
1
123
-28
0
%

3 ! /

• $ D , ,
3 >&&

• e &
# / 0.xxxxx$
0

'(
0.
1.0
1.
3.1415
31415e-4
1.6e-19
1e12
.001
-36.
% %

* !" /
D & $ e d

'(
0d0
0.d0
1.d0
1d0
3.1415d0
31415d-4
1.6d-19
1d12
-36.d0
% % 4 5

3 "!+ /
/ ( >
! "4 , ! "$
'(
(0.,0.)
(1.,-1.)
(1.34e-7, 4.89e-8)

)'. -
' & , , 3 /
;

' D & && &


1 "
2 5

parameter(const1=valeur1,const2=valeur2, ...)

3 > D ( D
3 / &;. 2 / &
5 4

double precision q
parameter(max=1000, q=1.6d-19)

/ 0 .

/ &
$

/
• 3 /
• &
7 , /$ &
• & 3

0, 1 & ' D , /
& $ / & /
9 $ 0& $ 6& 1 &1 ' 56 678$ 3 (
/ /
/

• / & ?
3 0, &
• -$ / & 3

# / / $ > ,
common C%
0 .
7 8
' 1
program

subroutine

function

( /
2 5

type var1, var2, var3, .....

5 / D 3 D
"

5 4

integer i,j,k
real alpha, beta
double precision x,y
complex z

' 0 .
# / $ &
• 0
o $
o >&& $
o */ + $
o *G+ * + * +
• D
• ! !9/&" &! & :&!! !- * *! epsilon1 epsilon2 D /
• 6 && 2
)& '&
5 / & $
/
i,j,k,l,m,n 3 integer
/ H a h o
z 3 real
% ; IMPLICIT
' & & " :& / &
implicit type (lettre1-lettre2, lettre3, ....)
/ H ! .
& 3
0 D 2
program

subroutine

function

5 4

implicit real (a-c,e,w-z)


a,b,c,e,w,x,y,z real
implicit double precision (a-h,o-z)

) & i,j,k,l,m,n integer$


double precision &:! !1<
<
implicit complex (z)
I complex &
implicit none

1 ! % ! ! !! % " * ! 2234 5
%

" , / ( /
1 &1! , / ,

% 0 .
2 5

nomvar = constante Ex : x=1.23

nomvar = autre variable Ex : x=y

nomvar = opération Ex : x=y+3.2*z

% 4
• / =
• '&&
• 7&& / > =
5 4

i = i + 1

7 / i * &1" &+ /

6 & ' 7 ' -


& 7' -

! 6 >

7 +

) -

J *

9 /

# **

/ " > -

9 ( $ ,/ ** /$ *$ & + -
5 1 ( >
5 4

x=a+b/c-d

x=(a+b)/(c+d)

0 )& &

( 3 &&
> ,
, 3 & / 3
,
! , && $ 3 3
&
3 , & & /
• "!+
• * !"
• !
• #
• !# !
5 4
b**2 3 b
4*a*c 3 & a c
)a c !$ b* !" $ b**2-4*a*c * !" $
$ a*c && $ ,? /
% 7
2/3 3 # 7 && $
C# && ( $ 2./3$ 2/3. 2./3.
- i/j ?i j ( / # K real(i)/j
0 )&

, / && (
3 && $ ,(
3 /
5 4
i=1.3456 && / # i
7
x=2/3 && / !x CCLLL
' 7 ' -
& 56 678 / / , 3
&-" ! , 3 & C;
0 & > & / "! ". 5
, D & 3 , # ( & SIN
$ DSIN / $ CSIN (
-

• , & = &! & / & >:!!


• 0> & & ) 1 M ,( $
, 1 1 , D

5 4

z=(a*sin(x)+b*cos(y)) / (a*sinh(x)+b*cosh(y))
# & /
pi=4d0*datan(1d0)

! 6$ > &
@

* !
! "!+
"

)-8 9)-8 0)-8 ! '

05) 905) 005) !'

78 9 78 -'

7)-8 97)-8 &! '

705) 9705) & !'

7 78 97 78 & -'

)-8N 9)-8N !>'

5: C 9 5: C -C '

5: 9 5: 0 5: '

'O# 9'O# 0'O# '/ '

)E6 9)E6

! 6( &

* !
# ! "!+
"

J7OC 7J7O 9J7O " ' '$?

J-8C 7J-8 9J-8 " '$?

Q'Q
-7P) 7P) 97P) 07P)
Q@Q

#
-8 7-8 9-8

6
J59 7J59 9J59

0
0 & ( , 3 3
& " && & , 3 ,/
3
# 6 3
R

0
& M &
• , && ' & , /
, ( &
• , S , > $ , 1 1
>&& & & && D &
0 D $ > / ( ,
$ , && $ , > & $ D
& (
5 4
1.+1e-8
1d0+1d-16 C
9 / (>/ ,
9
# ( $

> C > > $


$ C D L

8 ' & 9
( B >M 9 > $
3
7
' > *
+
'(
'Ceci est une chaîne'
'/home/louisnar'
'L''apostrophe doit être doublé'

0 . 7
)3 (
character*n var
? >M 0 3
B
'(
character*15 nom
character*100 nomfichier
5 && / , = /
C

nomfichier='/usr/local/public/louisnar/th.mai'
nom='Louisnard'

0 > M 'Louisnard' R $ % nom


&& / ) && / >M " >M
% $ 3 ,(
7
3 %A
LEN(chaine) chaîne
,( $ len(nom) " RL / nom
& >M "
%A %A %A
INDEX(chaine1, chaine2) > M chaine2 >
chaine1
# ( 2 ,( $ index(nom,'nar') %
%A
chaine(m:n) 1 >M chaine m n D
/
% %
( >M / / ' 56 678$
//
# (
'Bon'//'jour'
>M
'Bonjour'
2 ,(
nom //'est mon nom'
>M
'Louisnard est mon nom'

: ;
5 * &1!+ & !+$ ,(
• , $ , $ $
• & >
• , >

56 678 , && >
# $ , write
• T $
• & > $
• >M
# $ , read
• $
• & >
• >M
5 U
0T 0,
$ U & > ( >M

E & & 0, U & >


/
< '
2 5

write(unité d'écriture, formatage) liste de données


• , 1 31& & # , $ *
• & ! !B * &" - ( & &
56 678 & *
5 4

write(*,*) i,j,x,y
/ i,j,x,y $ /
write(*,*) 'z vaut',z
> M *z vaut +$ / z
" , write 9
write ,&& >
' %
& $ > & & , , ,

4
9 (
• 9 , write >M
write(*,'format') liste
• 9 * / + , format
nn format(définition du format)
write(*,nn)
0 , D & write
4
9 & $ in ,&& > ,

• ), 3 / $ , >
• ) && $ 2 / >
'(
i=11
j=20312
write(*,'(i6,i6)') i,j

V , format
10 format(i6,i6)
i=11
!

j=20312
write(*,10) i,j
4 ;
9 & $ en.m ,&& > &
" >&& & &$ ,

• ), 3 / $ , >
• ) && $ 2 / >
# & > $ &
'(
x=-1456.2
y=1.6e-19
write(*,'(e14.5,e14.5)') x,y

&& >

4 %A
9 & $ an ,&& > >M
• ) & $ >M $ 2 / >

• ) , & $ >M / L
5 2 $ a
5 4 4 45

i=36
px=-1456.2
write(*,'(a,i4,a,e12.5)')
& 'i vaut', i, ' et x vaut', x
&& >
i vaut 36 et x vaut -0.14562E+04
% %
& D , $! " 1 !! & 9 &
& * && $ &
'
& ,
• 7
• 7 (& > (
%
5 , $
• & > 6' 68 $
• & & > (
D D /
.

2 5

read(unité de lecture, formatage) liste de variables


• , # $ *
• & ! !B * &" write
%

, &
/ * + " /
>M $ & / &
& >M a
5 4

real a,b,c
...
read(*,*) a,b,c
, ,& >
6' 68 5 / & & # $! a$ $% C1
R b .! c$ ,
1.2 1.6e-19 32
( , , D
write(*,'(a,$)') 'Entrez x :'
read(*,*) x
&& > $ , (
6' 68

= % 9
>M , , #
0& $ & D 3 & /
W ,(

%
'( , & $ (

2 5
# ( , -B
if (condition logique) then
...
...
endif
5 & , ( -B &
if (condition logique) then
...
...
else
...
...
endif
5 D >M
if (condition logique 1) then
;

...
...
else if (condition logique 2) then
...
...
else if (condition logique 3) then
...
...
else
...
...
endif
( / ,
endif ) , $ / else (
9& -
0 /2 3 logical
- (
.true.

.false.

( , ( /2
' > ' 56 678 ' 7

' X? x.eq.y * +

x.ne.y * +

'Y? x.gt.y * > +

'A? x.lt.y * > +

x.ge.y * +

x.le.y * +

5 / (
5 .or.

' .and.

5 ( & .xor.

8 .not.

5 4
# & ,
*5 + O 2 o $ N n
"

character rep
...
write(*,'(a,$)')
& 'Répondez par (o)ui ou (n)on :'
read(*,a) rep

if (rep.eq.'0'.or.rep.eq.'o') then
write(*,*) 'Vous répondîtes oui'
...
else if (rep.eq.'N'.or.rep.eq.'n') then
write(*,*) 'Vous répondîtes non'
...

else
write(*,*)
& 'Vous répondîtes n''importe quoi'
...
endif
# ,
double precision a,b,c,delta,x1,x2
...
delta=b**2-4*a*c
x1=(-b-dsqrt(delta))/2/a
x2=(-b+dsqrt(delta))/2/a

if (delta.gt.0d0) then
write(*,*) x1,x2

else if (delta.eq.0d0) then


write(*,*) x1

else
write(*,*) 'Pas de racines'
endif
; LOGICAL
5 / 3 &&

• .true. .false.$
• , (

0 & /
# ( $ ,
double precision a,b,c,delta,x1,x2
logical une_racine
logical deux_racines
...
delta=b**2-4*a*c
une_racine=(delta.eq.0d0)
deux_racines=(delta.gt.0d0)

if (deux_racines) then
x1=(-b-dsqrt(delta))/2/a
x2=(-b+dsqrt(delta))/2/a
write(*,*) x1,x2
else if (une_racine) then
x1=-b/2/a
%

write(*,*) x1
else
write(*,*) 'Pas de racines'
endif

.
%
/ ,( , & ,&&
/ / D

• , $
• / ,

% DO ENDDO
5 && / / &
> +
do var = deb, fin
...
...
enddo

do var = deb, fin, pas


...
...
enddo

0& / 3 integer $$ * / ! /2 3 integer


/
/ 0& ,/ $ /! > / 9 0&
Y* $ / , D ,( enddo
, / ! D &
) * A $ / !YC$ / , 2 (
) * Y $ / !AC$ / , 2 (
+ "!
) / 2 ,

... ! affectation de n
somme=0

do i=1,n
somme=somme+i
enddo

/
... ! affectation de n
somme=0

do i=n,1,-1
somme=somme+i
enddo
) / &
... ! affectation de n
somme=0

do i=1,n,2
somme=somme+i
enddo
% DO WHILE
5 && / , &
> +
do while (condition logique)
...
...
...
enddo

5 / .true. ( /
, .true.
9 , & , / $ .false.$ ,( enddo
? "
# / $ & .true.
, ) , $ , D 2 # I13L
+ "!

) 2 , & &

integer n
double precision somme, epsilon
... ! affectation de epsilon
n=1
somme=0
do while (1d0/n**2 .ge. epsilon*somme)
somme=somme + 1d0/n**2
n=n+1
enddo
# $ / logical
integer n
double precision somme, epsilon
logical fini

... ! affectation de epsilon


n=1
somme=0
fini=.false
do while (.not. fini)
somme=somme + 1d0/n**2
n=n+1
fini=(1d0/n**2 .lt. epsilon*somme)
enddo

GOTO CONTINUE

- , , >Z S / $ &
& / L
@

/ > / &&
0 56 678 *& > + / >
9 $ 1 $ / > /
2 5

goto No de label
' $ / >
/ ' $ & / & $
, & continue
5 4
#
character rep
...
10 continue
write(*,*) 'Repondez oui ou non'
read(*,*) rep

if (rep.ne.'o'.and.rep.ne.'n') then
goto 10
endif
...

@ . 9
7 3 56 678$ & $ $ D
/ (

type var(m1, m2, ...)


m1$ "C$ / ' D ! ! ! :&! -
/ 7 , / 56 678 &( &

5 4

real v(100)
double precision a(100,100)
integer i(20)
4 %
# / ($ 3 /
parameter (max=100)
double precision a(max,max)
real v(max)
% %
7 / $ I , / a 1
(
. 9
5 3 >
D /
5 4
) (
R

double precision a(max,max)


double precision b(max,max)
double precision c(max,max)
...
do i=1,max
do j=1,max
c(i,j)=a(i,j)+b(i,j)
enddo
enddo
# (
double precision u(max), v(max)
double precision prodsca
...
prodsca=0
do i=1,max
prodsca=prodsca + u(i)*v(i)
enddo

READ WRITE 0 . '&


0, ( , - ,
, / do enddo / read write
2 5

read(*,*) (var(i), i = i1, i2, i3)


write(*,*) (var(i), i = i1, i2, i3)
i / $ var(i) ( /
/ i i1$ i2 i3 D / do
5 4
, D
read(*,*) (v(i), i=1,n)
K = , , $ *! +
write(*,*) (a(i,j), ' ! ', j=1,n)

& ' . 9
4 7
/ ( & B / '
$ > ( / , $
/ $ /
9 ,( , $ / ( 56 678
a(100,100) b(100,100) B a

D b # & ( $ , 0$
/ D && . W CC
, / 56 678$ & B
!C

9 ,( , $ / n
$ ( / nligne ncolon
5 4

K ( D &&
5 "C @C
5 . / ( $ ( / nligne ncolon B
, 0 / [ ,
parameter (mligne=50, mcolon=80)
double precision a(mligne, mcolon)
double precision b(mligne, mcolon)
double precision c(mligne, mcolon)

integer nligne, ncolon

write(*,*)
& 'Nombre de lignes des matrices'
read(*,*) nligne
write(*,*)
& 'Nombre de colonnes des matrices'
read(*,*) ncolon

write(*,*) 'Matrice a '


do i=1,nligne
read(*,*) (a(i,j), j=1,ncolon)
enddo

write(*,*) 'Matrice b '


do i=1,nligne
read(*,*) (b(i,j), j=1,ncolon)
enddo

do i=1,nligne
do j=1,ncolon
(i,j)=a(i,j)+b(i,j)
enddo
enddo

end

A .
.B
4 %
- & , & & D > , D
$ ( && # (
• )

• 0 & '

• 0 , & '$?
!

% %
5 / / / 5 > > * * &" &+ >
/ / & /
'( $ & $ && >
5 / /

• && (

• && > ,

/2 56 678 / !$& ! * !
5 > / D $ , ,( *
+ , U # 1 , / $
, &
( / ,( 56 678 */ &":&!* &" !+$
/ ( /
7 , $ / & 1
/
• 5 / - J7 . & $ & > . $ $$
• 5 J J7 & $$ / /
• J J7 & / /!
• 7 J7 && > /!
)3 / / & C
# A 0 ( /
&

.
0, , / , ' D
$ / &
/ &

• & $ /
o
o 3
!!

D% 3
subroutine nomsub(pf1, pf2, pf3, ...)
type pf1
type pf2
type pf2
...
Déclaration des variables locales
...
Instructions exécutables
...
return
end
/
• & / $
• / $
• / ,
/ /
, / &
3
, , / & / & $
/ $& , call
call nomsub (v1, v2, v3, ...)
0E$ 0C$ 0F D
• / / & $
• L
4

3 0E$ 0C$ 0F$


( ( & /*E$
/*C$ /*F$
5 4
K /
'$?

# A$ 0 , /

subroutine polar(x, y, r, theta)

double precision x, y, r, theta

double precision pi
double precision temp

pi=4*datan(1d0)

r=dsqrt(x**2+y**2)
!.

temp=datan(y/x)
if (x.gt.0d0) then
theta=temp
else if (x.lt.0d0) then
theta=-temp
else if (x.eq.0d0) then
if (y.ge.0d0) then
theta=pi/2
else
theta=-pi/2
endif
endif

return
end

& C! / /
( , /
programm
...
double precision a, b, rho, phi
...
call polar (a, b, rho, phi)
...
end
4 7 4

• / a$ b$ rho phi / ,
/ polar
• / pi temp / / polar ,

• x$ y$ r theta & / polar 0


/ , ,( /

' $ ,3 / x$ y$ r
theta$ !3 & G0 & 0 !/ &":&!* &" ! !$&
' >$ / / , , polar
call polar (x, y, rho, phi)
/ x /
& $ , x$ ( /2 /
5 %% E
6 /
5 %% C
9 & C.$ 3 W / 0 I1 $
I (
• E /
o F
o / F
• # ,1 1 / integer LF
• # / & %/F
0 I / , && L %/
!;

# A( # L %/

program factcnp

do i=1,100
call factor(i, facti, ifaux)
write(*,*) i, facti
enddo

write(*,*)
& 'Entrez deux entiers i et j'
read(*,*) i, j

call calcnp (i, j, cij)


end

subroutine factor(n, fact, ierr)

integer n, ierr
double precision fact
...
return
end

subroutine calcnp (n, p, cnp, ierr)


implicit double precision (a-h,o-z)
integer n, p, cnp
...
return
end

& / $
0, 1 1 , , call$ , =
,&&
5 2 & & 56 678$ ( datan$ , ,
&
pi=4*datan(1d0)
;
# & $ D 3 # (
datan double precision ' 3 & $ &
, & 3 ,
& && & $
& /
D% 3 %

type function nomfonc (pf1, pf2, ...)


type pdf1
type pdf2
...
déclarations des variables locale
...
instructions exécutables
! devrait contenir quelque chose comme : nomfonc = ...
...
!"

return
end
3 D 3 & &( &
3 %
& / / & $ /
0 / $ ! !/ !$ &!/ & &&!/ & ! &-" !/ !!1!
G * !!/ &":&!* &" !
& 3 & & $
/ & ? , ) / $ 3
/ & ,
5 4 E
3 1 ($3 & C;

# A/ 0 &
program test

double precision abscis, ordonn, r


double precision rayon

read(*,*) abscis, ordonn


r=rayon(abscis, ordonn)
write(*,*) r
end

double precision function rayon (x, y)

double precision x, y

rayon=dsqrt(x**2+y**2)

return
end

5 4 C
& C"

# A6 ,

program test
character c, litcar

do while (litcar() .ne. 'q')


write(*,*) 'On continue'
enddo
end

character function litcar()


read(*,*) litcar
return
end
!%

' ' & ' .

# A8 #
,( & polar

/ / & B &(
0 $ * / + /
0 / ( , / integer real
/ ; $ / double precision @ $ / CC real$
/ $ double precision /
J $ , / ,
7 & / & /
&& B ; 8-O , / & $
3 &!! /&" & &-" , & $
$ $
& C% ,( / polar
/ $ & x 3
/ =$ @ , x CCCC CCC $
, 1 1 a
, && & theta$ @
, theta CC!; CC. $ , 1 1 phi
9,? , / 3 ,
3 % COMMON
5 & / , / & $
/ - ( 3 , , / / &
common
common / /
/ & ?, common
> +
common/nomcom/v1, v2, v3...
?
• common
• 5 parameter common
/ (
• 5 D / (common &&
• 5 & common
• 5 / ( common$ D
• & $ , > common
D / & ? M5 >
/ ( , D common$
!

+ "!
# A: '(
, , common

program test

double precision pi
real a, b

common /trig/ pi
common /bidon/ a, b

pi=4*datan(1d0)
...
end

subroutine truc (x,y)

common /trig/ pi
common /bidon/ u, v

double precision pi
real u, v
...
y=x*tan(pi*u/v)
...
return
end

9 ,( & C $ / common bidon


&&
J , 3 ! real > u a (
D /2 D I 0 $ ( D

& ' ' )& .


5 / ( / & 1 H
0 11 & 3 / ( F0 /
,
1 vC * D
, / v
subroutine sub (v, ...)
type v(*)

m C$ * D
& &
&
subroutine sub (a, mligna, ...)
type a (mligna, *)

0 , (
& $ 1
/ & '
/ D *
/ 3 / 2 D
!@

5 %%
7 ( / $ ( I
& 3
5 4
)/ / $ /
$ / & C@
-& / 3 ( mat
$ $ & /
/ (

# A= ,
program test
parameter(mligne=10, mcolon=20)
double precision mat (mligne, mcolon)

call litmat (mat, mligne, nligne, ncolon)


end

subroutine litmat (a, ma, nl, nc)

double precision a (ma, *)

write(*,*)
& 'Entrez nombre de lignes-colonnes'
read(*,*) nl, nc

do i=1, nl
write(*,*) 'Ligne ', i
read(*,*) (a(i,j), j=1,nc)
enddo

return
end

& a / , mat , $
C & ma$ D
mat
5 %% E
E 11 , / C U /
!CF
5 %% C
K / && > , $ / I1 litmat &

EXTERNAL
%
, & , / , &
/

'( / K / ,
& *B B E & 11 & / F
• & *
• / , $
!R

• ,
5 3 56 678 & * ' F 0, ,
& 56 678$ ( real
5 & / ,
subroutine integ (a, b, f, valint)
& a$ b valint double precision$ 3 fF
0, , & 56 678$ & /I $

external f

real f
f real 5 & 3 / $
external 9 / $ & / [ &
f , # && L5 & ( > 3
valint = valint + h/2 *(f(x1+h) + f(x1))
J / , \ > , & 2
,
56 678$ 3
real function truc(x)
real x
...
truc=...
return
end
\ ( / integ , & !
\,
call integ (1.0, 2.0, truc, somtruc)
1.0 2.0 real$ somtruc / real
,
' truc F0, , & 56 678 7 12 >
/ F $ 2
external truc
/ & ,? 2 & call 9 $ &
real$ 2
,2
real truc
%
& CR , ,(
# A@ ) ,
,
.C

program test

real somtruc

external truc
real truc

call integ (1.0, 2.0, truc, somtruc)

end

subroutine integ (a, b, f, valint)

real a, b, valint
external f
real f
...
valint=valint + ( f(x1+h) + f(x1) )*h/2
...
return
end

real function truc(x)


real x
...
truc=...
return
end

6 truc / &
& f 8
(
real function truc(x,y)
' $ / 3 integ / &
$ 2 3 & , , (
& / $ &
& /
5 %%
K , U / U&
I , & *' > 8 ] 5 >
& *' *,'

7
1 & > !1B !$ , 1 1 ,
, & > $ , ? B $
7 & $ / & * >&
,
- ( 56 678 & > G :! & $ ,
& > (3 & > & & > /
7 '
# $ & > ( $ , 1 1 $ ,
.

, /2 56 678 3 & > $ 1 >M


& & , &
0 3 & > ( $
& > (
, & > &
7 .
/2 56 678 3 & > , B #
( $ $ ; &
9 & $ 3 U & >
, & > / (
0 % 7
- , , & > 2 ( , 56 678
& > * 1+$ 56 678 & >
& 7 & > , , ,
2 5

open( numéro d'unité,

file=chaîne de caractère,

form=chaîne de caractères,

status=chaîne de caractères,

err=numéro de label

, , & > $ & >


$ & ,
status='append'

%
Numéro d'unité
C RR 5 / integer

file=
, >M & > (
'/home/louisnar/truc' / / 3 >M & >
form=
>M D

• 'formatted' & > & 0, &


• 'unformatted' & > /

status=
>M D

• 'new' & > $ , (


• 'old' & > $ , ,(
• 'unknown' & > , 0, &
• 'append' & > & 1

err=
.!

/ , ,
5 4

open(10,file='ethanol')
& > & ethanol $ , ( $ , > ,
C
integer unite
character*80 nomfich
...
unite=10
nomfich='ethanol'
open(unite,file=nomfich)
& D > ,(
character*80 nomfich

nomfich='bidon.dat'

open(10,file=nomfich,form='unformatted',
& status='new',err=99)
... ! (l'ouverture a réussi)
99 write(*,*) 'Fichier ', nomfich,
& 'deja existant'
...
3 & > / bidon.dat && > , ?
& > ( 2
' % 7
0,
close(numéro d'unité)
0 > , & > # & > $
& , , open
8 $ & >
&
;< 7
2 5

read( numéro d'unité,

format,

err=numéro de label,

end=numéro de label) liste de données

write( numéro d'unité,

format,

err=numéro de label) liste de données


• # & > & $ , &
# & > & $ & # U & $ & *
& & $ & , $
..

err=numéro de label
' , $ /
end=numéro de label
/ , & & > $ ,
3
$ /
? " , && write & > $
! ! 1!! 0 /! & / & * > &! ** 1!
7 , & > ( status 'old' 'unknown'$ ,
& write$ && 7 $ , 2
& > 2 ( $ & , status='append'
9 '& % 7
%A 3 %A 5
5 & > ( truc.txt M / && >
, & > ( cat 8-O
0, ( goto
character*80 ligne

open(20,file='truc.txt')

10 continue
read(20,'(a)', end=99) ligne
write(*,*) ligne
goto 10

99 continue
end
%H (5 2.
K / ( ' ? double precision
> $ >M @C & > $ & > (
' ?
subroutine ecritxy (x, y, nomfich)
character*80 nomfich
double precision x(*), y(*)

open(20,file=nomfich)

do i=1,n
write(20,*) sngl(x(i)), sngl(y(i))
enddo

close(20)
return
end
# x(i) y(i) real & sngl F
56 678 / *$ & 1 D
E$ ( 1.345367222D-5 1.345367222E-5
J > / & > ( J7 7P
E D
.;

9
5 , $
# / , $ / $ >
$ , , . . , & > ( # ( $ & >
eau
2
373
5e7
K / / >M & > $
&

• $ & > $
• , C $1

Vous aimerez peut-être aussi