Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error message in statement

Status
Not open for further replies.

anthony68

Programmer
Sep 6, 2007
11
NL
program zetels;
uses Wincrt;
var win,cda, pvda, sp: real;

begin
writeln ('cda');
readln(cda);
writeln('pvda');
readln(pvda);
writeln('sp');
readln(sp);



procedure coalitie;
begin
if cda+pvda+sp< 75 then
writeln('coalitienietmogelijk');
end;


begin
if (cda > pvda) and (cda > sp)
then
writeln('cda wint');

if (pvda > cda) and (pvda > sp)
then
writeln('pvda wint');

if (sp > cda) and (sp > pvda)
then
writeln('sp wint');

end;






end.
 
Hi

Code:
[b]program[/b] answer;
[b]begin[/b]
  WriteLn([i]'In Pascal all declarations must be done in the declaration part of the (sub)program.'[/i]);
[b]end[/b].

Feherke.
 
To clarify feherke's "(sub)", procedures can be declared inside another procedure's declaration (at least in TP; I don't know the standard)

program main;

procedure thing;
var
aninteger : integer;
procedure subthing;
begin
... code goes here...
... this procedure is only accessible within thing ...
end; { of subthing }
begin { thing! }
... more code goes here ....
subthing; { can be called within thing }
... code ...
end; { of thing }

begin
thing;
end. {of program }

This isn't a feature I use a lot, as I get confused about how local variables are handled between thing and subthing.
 
thank you it works i forgot to call the procedure in the programbody
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top