TYPE

 !Program name: TYPE

program bookstore

 

   !type declaration

   type Books

      character(len = 50) :: title

      character(len = 50) :: author

      character(len = 150) :: subject

      integer :: year

   end type Books

 

   !declaring type variables

   type(Books) :: book1

   type(Books) :: book2

 

   !enter the components of the structure

  

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

   Read *, book1%title

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

   Read *, book1%author

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

   Read *, book1%subject

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

   Read *, book1%year

 

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

   Read *, book2%title

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

   Read *, book2%author

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

   Read *, book2%subject

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

   Read *, book2%year

 

   !display book info

 

   Print *, book1%title

   Print *, book1%author

   Print *, book1%subject

   Print *, book1%year

 

   Print *, book2%title

   Print *, book2%author

   Print *, book2%subject

   Print *, book2%year

 

end program bookstore

Comentários

Postagens mais visitadas deste blog

RECURSIVE

HYDROGEN-RADIAL

RUNGE-KUTTA