HP Forums

Full Version: help programming
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I wrote a program that is giving me a syntax error:

EXPORT PROG1(A,B,C)
BEGIN
LOCAL D=0;
LOCAL E=0;
(-B+SQUAREROOT(B^2-4AC))/(2A)->D;
(-B-SQUAREROOT(B^2-4AC))/(2A)->E;
MSGBOX(D,E);
END;

squareroot is replaced by the square root symbol in the code
So what is the problem?
(03-22-2014 05:43 PM)Arcturus314 Wrote: [ -> ]So I wrote a program that is giving me a syntax error:

EXPORT PROG1(A,B,C)
BEGIN
LOCAL D=0;
LOCAL E=0;
(-B+SQUAREROOT(B^2-4AC))/(2A)->D;
(-B-SQUAREROOT(B^2-4AC))/(2A)->E;
MSGBOX(D,E);
END;

squareroot is replaced by the square root symbol in the code
So what is the problem?

I presume that -> is the actual store arrow. The problem (based solely on your source code) is that MSGBOX() only takes a single argument. You've separated D and E as two arguments and there is no such instance of MSGBOX() using two arguments. Instead, try: MSGBOX({D,E}).
Have you tried putting a multiplication symbol (*) between the 4 and the A and the A and the C, and the 2 and he A?

BAF

(03-22-2014 05:43 PM)Arcturus314 Wrote: [ -> ]So I wrote a program that is giving me a syntax error:

EXPORT PROG1(A,B,C)
BEGIN
LOCAL D=0;
LOCAL E=0;
(-B+SQUAREROOT(B^2-4AC))/(2A)->D;
(-B-SQUAREROOT(B^2-4AC))/(2A)->E;
MSGBOX(D,E);
END;

squareroot is replaced by the square root symbol in the code
So what is the problem?
Thank you, that fixed it! I didn't know that msgbox only accepted 1 argument. I also assumed it would multiply variables automatically.
When you press the "CHECK" button, where did the cursor go? My guess is it put it right on the message box.
(03-22-2014 06:13 PM)Tim Wessman Wrote: [ -> ]When you press the "CHECK" button, where did the cursor go? My guess is it put it right on the message box.

Yep. Just tested it.
Reference URL's