Here is a program that I wrote using records in Pascal to accept and display the input information regarding the book. The code is very easy to understand I am using Turbo Pascal for Windows in this sample program.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.
Sample Program Output
Program Listing
books.pas
program BooksInformation;
uses
  WinCrt;  
  Type
 Str200    = String[200];
 TBookRec =
   Record
    Title, Author, ISBN : Str200;
                                Year  : Integer;
    Price : Real;
   End;
Procedure EnterNewBook(var newBook : TBookRec);
Begin
        Writeln('Book Information Using Records in Turbo Pascal.');
        Writeln;
 Writeln('Please enter the book details: ');
 Write('Book Name: ');
 Readln(newBook.Title);
 Write('Author: ');
 Readln(newBook.Author);
 Write('ISBN: ');
 Readln(newBook.ISBN);
        Write('Year:');
        Readln(newBook.Year);
 Write('Price: ');
 Readln(newBook.Price);
End;
Procedure DisplayBookDetails(myBookRec : TBookRec);
Begin
 Writeln('Here are the book details:');
 Writeln;
 Writeln('Title   :   ', myBookRec.Title);
 Writeln('Author  :   ', myBookRec.Author);
 Writeln('ISBN    :   ', myBookRec.ISBN);
        Writeln('Year    :   ', myBookRec.Year);
 Writeln('Price   : $  ', myBookRec.Price:5:2);
        Writeln;
        Write('End of Program');
        Writeln;
End;
Var
 bookRec : TBookRec;
Begin
 EnterNewBook(bookRec);
 Writeln('Thanks for entering the book details');
 DisplayBookDetails(bookRec);
End.

No comments:
Post a Comment