Fix makefile, add simple fortran program (#93)

* Add simple fortran program to examples
* Fix makefile bug
This commit is contained in:
Chris Coutinho 2017-08-01 19:14:02 +02:00 committed by Chad Smith
parent fa509618fb
commit 79b01e701e
2 changed files with 33 additions and 1 deletions

View file

@ -0,0 +1,28 @@
program array
integer, parameter :: n=3
integer :: ii
real, dimension(n) :: a, b
real, dimension(n,n) :: c
a = [( real(ii), ii=1, n )]
do ii = 1,n
print *, a(ii)
enddo
b = 0.
do ii = 1, n
! You could just write b = a ** 2., but I want to see the loop progress
b(ii) = a(ii) ** 2.
enddo
do ii = 1, n
print *, b(ii)
enddo
c = reshape( [( real(ii), ii=1,n**2 )], [n,n] )
do ii = 1, n
print *, c(ii,:)
enddo
end program

View file

@ -24,5 +24,9 @@ tree: tree.c
linked_list: linked_list.cpp
g++ linked_list.cpp -o linked_list_cpp.a -std=c++11 -g
../gdbgui/backend.py linked_list.a
../gdbgui/backend.py linked_list_cpp.a
fortran: fortran_array.f90
gfortran fortran_array.f90 -o fortran_array.a -g
../gdbgui/backend.py fortran_array.a