How to call a procedure

Computer builds, hardware and software discussion or troubleshooting, including peripherals. Essentially a general place to talk about desktop computers.
Locked
Anonymous

How to call a procedure

Post by Anonymous »

var base,height,L1,L2,L3:int
proc Userinfo (var base, height, L1, L2, L3 : int)
put "Please enter the base of the triangle"
get base
put "Please enter the height of the triangle"
get height
put "Please enter the 1st length of the triangle"
get L1
put "Please enter the 2nd length of the triange"
get L2
put "Please enter the 3rd length of the triangle"
get L3
end Userinfo

proc Area (var A,base, height : int)
A := base * height div 2
end Area

proc Perimeter (var P, L1, L2, L3: int)
P := L1 + L2 + L3
end Perimeter

proc AP (var A,P, L1,L2,L3,b,h,AreaPerimeter: int)
AreaPerimeter:=A and P
end AP


Hi i was wondering why the program does not run.. also how do i call a procedure. If you could help me with this it will be appreciated

Archived topic from Iceteks, old topic ID:3988, old post ID:32750
User avatar
Death
Posts: 7919
Joined: Thu Sep 30, 2004 10:12 pm

How to call a procedure

Post by Death »

I'm going to wager a guess that you're using turing. I haven't used that language in a looooooooooong time, but I vaguely recall the syntax for writing a procedure was

procedure **PROCEDURENAME** (**parameters**)

**your code here**

end **PROCEDURENAME()**

Where the stuff in ** symbolizes your procedure's name and your parameters and your code. Another reason it isn't working is because you initialized the procedure (if it didn't give you a syntax error) but you haven't called it. Try calling it into your program directly under your code and before your procedures by going:

**PROCEDURENAME** (**variables**)

Hopefully that works for you (Again, I am assuming you are using turing). And remember, any part of code I wrote down with **'s is general, meaning you can substitute any name for it. For example PROCEDURENAME can be like myprocedure, area, mydogshouse whatever you want.

Archived topic from Iceteks, old topic ID:3988, old post ID:32751
Locked