Mercurial > hg > octave-nkf
annotate examples/code/fortransub.f @ 20412:b7ee5cefa9d6 stable
Update make_int example to current octave_base_value API (bug #45136)
* make_int.cc (octave_integer::print): Make non-const. Add a newline
for consistency with core library conventions.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Mon, 18 May 2015 19:14:41 -0400 |
parents | c8240a60dd01 |
children |
rev | line source |
---|---|
18437
4b32677b6229
Rename Fortran example files from 'fort' prefix to 'fortran' prefix.
Rik <rik@octave.org>
parents:
9053
diff
changeset
|
1 subroutine fortransub (n, a, s) |
6572 | 2 implicit none |
3 character*(*) s | |
4 real*8 a(*) | |
5 integer*4 i, n, ioerr | |
6 do i = 1, n | |
7 if (a(i) .eq. 0d0) then | |
18437
4b32677b6229
Rename Fortran example files from 'fort' prefix to 'fortran' prefix.
Rik <rik@octave.org>
parents:
9053
diff
changeset
|
8 call xstopx ('fortransub: divide by zero') |
6572 | 9 else |
10 a(i) = 1d0 / a(i) | |
11 endif | |
12 enddo | |
13 write (unit = s, fmt = '(a,i3,a,a)', iostat = ioerr) | |
7081 | 14 $ 'There are ', n, |
15 $ ' values in the input vector', char(0) | |
6572 | 16 if (ioerr .ne. 0) then |
18437
4b32677b6229
Rename Fortran example files from 'fort' prefix to 'fortran' prefix.
Rik <rik@octave.org>
parents:
9053
diff
changeset
|
17 call xstopx ('fortransub: error writing string') |
6572 | 18 endif |
19 return | |
20 end | |
21 |