Solved

Compiler Difficulties

Posted on 1997-09-24
7
207 Views
Last Modified: 2010-04-16
I'm using Borland Turbo Pascal ver. 6.0 and it seems that the book I'm using to program with (I'm a beginner) is not compatible with the program.  I have copied programs word for word out of the book and, when I try to run or compile, the TP interpretter gives me an error message saying "Begin needed", when in fact the program is perfect according to the book.  I've tried this numerous times and either my programming style or the compiler/interpretter are seriously hindering the completion and application of my programs.  What can I do to fix this?  

Here is one of programs I copied word-for-word out of the book I'm using for those of you who enquired:

program Sine; (Input, Output);

   const
      Pi = 3.14159
      MinAngle = 0
      MaxAngle = 360

   var
      Theta, X : Real
      Work : Char

begin
   WriteLn ('Hello.');
      begin
         X := 180
         Theta = Sin(X)
      end
   WriteLn (Theta);
end.
0
Comment
Question by:Krueger092397
7 Comments
 

Expert Comment

by:ptiemann
Comment Utility
Probably the book is very bad and has errors.
You may post such a sample program here and we can tell
you whether the book is wrong or not.
0
 

Expert Comment

by:berox
Comment Utility
Are you sure you have copied complete programs out of the book,
And not just some fragments ?
As ptiemann said before , You have to post an example to see what is exactly wrong...
0
 

Author Comment

by:Krueger092397
Comment Utility
Edited text of question
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 1

Expert Comment

by:potsy
Comment Utility
what is this part of the program used for? (Input, Output) are you trying to link to it from another program? it also helps if you end your lines with ;
0
 
LVL 1

Accepted Solution

by:
FuzzyLogic earned 20 total points
Comment Utility
If I understand properly your question, the source you included it taken from your book...

Well, in THIS program, there are two errors:
  - After the program name (Sine) and the IO, there sould not be
    a semicolon. The first line should be something like:
       program Sine(input,output);
    Anyway, I think that in TP 6.0 you don't need the IO, and
       program Sine;
    would be enough.
    This is the place where the compiler says "BEGIN excepted".

  - After any statement, includnig the CONST part, you sould put
    semicolon:
       Pi = 3.141592;
    and so on in the VAR and in the program itself.

One more thing about this program: there is a logical-block with no need - between the two WRITELN.

Now ,to your question: What should you do...
That easy. You should do two things:
1. Get yourself a GOOD book that has programs WITHOUT bugs...
2. Get yourself a newer version of TP.
0
 

Expert Comment

by:igork
Comment Utility
The answer is good, but the program is bad amazingly for the textbook. There is also a bug related to Pascal assignement operator. One should always use ":=" instead "=" if he wants to assign value to variable. The "=" operator is boolean comparison or constant definition.
So line THETA=SIN(X) should be also rewritten as THETA:=SIN(X).

And of course you should get Borland Pascal 7.0.

Regards,
IgorK.
0
 

Author Comment

by:Krueger092397
Comment Utility
Well, thanks a lot, folks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now