Post Reply 
What is wrong with my code?
01-20-2021, 09:05 PM (This post was last modified: 11-30-2022 08:19 PM by Spybot.)
Post: #1
What is wrong with my code?
Hi!
I'm just trying to get the distance between 2 points and show the result in exact format, nothing fancy.... all I get is an "r" as a result. I'm using the latest version of the HP Primie Emulator.

My Code:

Code:

EXPORT DBTP()
BEGIN
LOCAL a:=0,b:=0,c:=0,d:=0,r:=0;
PRINT();
INPUT({{a,[0],{10,20,1}},{b,[0],{40,20,1}},{c,[0],{10,20,2}},{d,[0],{40,20,2}}},"Distance between 2 Points",{"X₁:","Y₁:","X₂:","Y₂:"},{"Input a value for X₁ (Real number).","Input a value for Y₁ (Real number).","Input a value for X₂ (Real number).","Input a value for Y₂ (Real number)."});
IF 0 THEN BREAK;
END;
r:=√((c-a)^2+(d-b)^2);
r:=exact(r);
PRINT("
  Distance between points:
  "+r);
END;
[attachment=9037]

Spybot.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
What is wrong with my code? - Spybot - 01-20-2021 09:05 PM
RE: What is wrong with my code? - rawi - 01-21-2021, 05:13 AM
RE: What is wrong with my code? - C.Ret - 01-21-2021, 08:27 PM
RE: What is wrong with my code? - Spybot - 01-23-2021, 01:25 AM
RE: What is wrong with my code? - C.Ret - 01-23-2021, 07:56 PM
RE: What is wrong with my code? - Han - 01-24-2021, 03:31 AM
RE: What is wrong with my code? - Spybot - 01-24-2021, 03:40 PM



User(s) browsing this thread: 1 Guest(s)