Compiler Difficulties

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.
Krueger092397Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ptiemannCommented:
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
beroxCommented:
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
Krueger092397Author Commented:
Edited text of question
0
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

potsyCommented:
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
FuzzyLogicCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
igorkCommented:
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
Krueger092397Author Commented:
Well, thanks a lot, folks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Pascal

From novice to tech pro — start learning today.