TYPE2

 !Program name: TYPE2

Program Bookstore

Integer, dimension(:), allocatable :: N

Print *, 'Enter the number of books of the bookstore: '

Read *, n

Allocate ( N(n) )

 

!type declaration

type Books

   character(len = 50) :: title

   character(len = 50) :: author

   character(len = 150) :: subject

   integer :: year

end type Books

 

do i=1,n

!declaring type variables

type(Books) :: booki

end do

 

do i=1,n

!enter the components of the structure

   write(*,*) 'Enter the title of the book ', i

   Read *, booki%title

   Write (*,*) 'Enter the author of the book ', i

   Read *, booki%author

   Write (*,*) 'Enter the subject of the book ', i

   Read *, booki%subject

   Write (*,*) 'Enter the year of the book ', i

   Read *, booki%year

End do

 

do i=1,n

   !display book info

   Print *, booki%title

   Print *, booki%author

   Print *, booki%subject

   Print *, booki%year

end do

stop

end program Bookstore

Comentários

Postagens mais visitadas deste blog

RECURSIVE

HYDROGEN-RADIAL

RUNGE-KUTTA