Krueger092397
asked on
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.
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.
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...
And not just some fragments ?
As ptiemann said before , You have to post an example to see what is exactly wrong...
ASKER
Edited text of question
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 ;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
Well, thanks a lot, folks.
You may post such a sample program here and we can tell
you whether the book is wrong or not.