Commit | Line | Data |
---|---|---|
15c46491 WZ |
1 | ! Copyright 2006 Free Software Foundation, Inc. |
2 | ! | |
3 | ! This program is free software; you can redistribute it and/or modify | |
4 | ! it under the terms of the GNU General Public License as published by | |
5 | ! the Free Software Foundation; either version 2 of the License, or | |
6 | ! (at your option) any later version. | |
7 | ! | |
8 | ! This program is distributed in the hope that it will be useful, | |
9 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | ! GNU General Public License for more details. | |
12 | ! | |
13 | ! You should have received a copy of the GNU General Public License | |
14 | ! along with this program; if not, write to the Free Software | |
15 | ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
16 | ! | |
17 | ! Ihis file is the Fortran source file for derived-type.exp. It was written | |
18 | ! by Wu Zhou. (woodzltc@cn.ibm.com) | |
19 | ||
20 | program main | |
21 | ||
22 | type bar | |
23 | integer :: c | |
24 | real :: d | |
25 | end type | |
26 | type foo | |
27 | real :: a | |
28 | type(bar) :: x | |
29 | character*7 :: b | |
30 | end type foo | |
31 | type(foo) :: q | |
32 | type(bar) :: p | |
33 | ||
34 | p = bar(1, 2.375) | |
35 | q%a = 3.125 | |
36 | q%b = "abcdefg" | |
37 | q%x%c = 1 | |
38 | q%x%d = 2.375 | |
39 | print *,p,q | |
40 | ||
41 | end program main |