# Help for Dev-Pascal. Merging two procedures.

January 31, 2011 at 10:42:00
Specs: Windows 7, 4.00
 Hi, I'm working on a Pascal program which when the user enters the speed of a vehicle, the given amount of a fine is shown. I would like to do this type : If (speed >90) and (speed <99) then n5In N5 i have this:Procedure n5; begin Clrscr; Writeln('The fine is of 90 Euros'); end; I want to know how to direct the user to another procedure with IF. Appreciated help. Thanks.

See More: Help for Dev-Pascal. Merging two procedures.

#1
January 31, 2011 at 10:50:37
 Have a look at the Pascal "case" statement.

Report •

#2
January 31, 2011 at 11:05:55
 Yeah okay, but how do I go to a procedure from another procedure? *the reason is because at school I haven't done "case" yet. And 2morrow I have a test about IF.*

Report •

#3
January 31, 2011 at 11:36:00
 I think this would be better...N5(speed)In N5 i have this:Procedure n5(speed:int);begin Clrscr; If (speed >90) and (speed <99) then begin Writeln('The fine is of 90 Euros'); end; else If (speed > 99) then begin Writeln('The fine is of 10000 Euros'); end; else If (speed < 90) then begin Writeln('The fine is of 10 Euros'); end;end; Untested but you get the idea.

Report •

Related Solutions

#4
February 4, 2011 at 09:55:08
 That method I know. But was expecting something like :Procedure Beginning; begin Textcolor(yellow); Writeln('What was the speed of the car?'); Readln(speed); If (speed >50) and (speed <=59) then {}{}{}Procedure n5; begin Clrscr; Writeln('The fine is of €50'); end;BEGIN Beginning; Readln;END.Where there is {}{}{} I would like to "Call" procedure n5. I appreaciate for helping me <3

Report •

#5
February 4, 2011 at 11:40:26
 Just do exactly that. Where you have "{}{}{}" just put "n5". Only thing to be aware of is that you must declare the procedure before you use it. Easiest way to do that is to move the definition of Procedure n5 in front of that of Procedure Beginning.

Report •