Line | |
---|
1 | !! kleines Doxygen Testprogramm
|
---|
2 | module pal
|
---|
3 | implicit none
|
---|
4 |
|
---|
5 | public :: anna
|
---|
6 |
|
---|
7 | contains
|
---|
8 |
|
---|
9 | function anna (strng) result (jein)
|
---|
10 | character(len=*),intent(in) :: strng !< eine Variablenbeschreibung
|
---|
11 | logical :: jein
|
---|
12 | character(len=1),dimension(len(strng)) :: feld
|
---|
13 | integer :: i,n
|
---|
14 |
|
---|
15 | n = len(strng)
|
---|
16 |
|
---|
17 | do i=1,n
|
---|
18 | feld(i) = strng(i:i)
|
---|
19 | end do
|
---|
20 |
|
---|
21 | i = n/2
|
---|
22 | if(all(feld(:i) == feld(n:n+1-i:-1))) then
|
---|
23 | jein=.true.
|
---|
24 | else
|
---|
25 | jein=.false.
|
---|
26 | end if
|
---|
27 |
|
---|
28 | end function anna
|
---|
29 | end module pal
|
---|
30 |
|
---|
31 | program otto
|
---|
32 | use pal
|
---|
33 | implicit none
|
---|
34 | character(len=*),parameter :: palin="retter"
|
---|
35 | logical :: heyho
|
---|
36 |
|
---|
37 | heyho=anna(palin)
|
---|
38 | if (heyho) then
|
---|
39 | write(unit=*,fmt=*) "JAWOHL!"
|
---|
40 | else
|
---|
41 | write(unit=*,fmt=*) "NOE!"
|
---|
42 | end if
|
---|
43 | end program otto
|
---|
Note:
See
TracBrowser
for help on using the repository browser.