chap10/sample6.f90

サンプルコードのダウンロード

 1program sample
 2  use mod_list
 3  implicit none
 4
 5  type(list_type), pointer :: a
 6
 7  nullify(a)
 8
 9  write(*, fmt='(a20)', advance='no') 'initialize : '
10  a = 1
11  call show(a)
12
13  write(*, fmt='(a20)', advance='no') 'append 2 : '
14  call append(a, 2)
15  call show(a)
16
17  write(*, fmt='(a20)', advance='no') 'append 3 : '
18  call append(a, 3)
19  call show(a)
20
21  write(*, fmt='(a20)', advance='no') 'insert -1 at 1 : '
22  call insert(a, 1, -1)
23  call show(a)
24
25  write(*, fmt='(a20)', advance='no') 'insert -2 at 3 : '
26  call insert(a, 3, -2)
27  call show(a)
28
29  write(*, fmt='(a20)', advance='no') 'remove at 1 : '
30  call remove(a, 1)
31  call show(a)
32
33  write(*, fmt='(a20)', advance='no') 'remove at 3 : '
34  call remove(a, 3)
35  call show(a)
36
37  write(*, fmt='(a20)', advance='no') 'delete : '
38  call delete(a)
39  call show(a)
40
41  stop
42endprogram sample