QROOT Program creates Syntax Error
|
06-18-2024, 07:49 PM
Post: #1
|
|||
|
|||
QROOT Program creates Syntax Error
Help.
I just inputted the QROOTS program into my HP Prime Calculator. The Program QROOTS EXPORT QROOTS(A,B,C) BEGIN LOCAL D; PRINT(); HComplex:=1; D:=B^2-4*A*C; IF D≥0 THEN PRINT("Roots are real."); ELSE PRINT("Roots are complex."); END; PRINT((-B+√D)/(2*A)); PRINT((-B-√D)/(2*A)); END; This is the error message I am getting "Syntax error in program line 8" Would you know why? I have tried degugging but to no avail. Cheers! |
|||
06-19-2024, 01:17 AM
Post: #2
|
|||
|
|||
RE: QROOT Program creates Syntax Error
(06-18-2024 07:49 PM)MullenJohn Wrote: Help. I copied and pasted your program into both the virtual Prime and physical Prime (G2). It worked fine on both. Tom L Cui bono? |
|||
06-19-2024, 01:24 PM
Post: #3
|
|||
|
|||
RE: QROOT Program creates Syntax Error
Thank you, Tom!
Could you consider why my HP Prime calculator gives the error message “Syntax error in program line 8”? The line is ‘ PRINT (“Roots are real.”); ’ I am stumped. Cheers! |
|||
06-19-2024, 01:42 PM
Post: #4
|
|||
|
|||
RE: QROOT Program creates Syntax Error
(06-19-2024 01:24 PM)MullenJohn Wrote: Thank you, Tom! It's hard to say. The line looks good and copying and pasting it works so I have no clue. You could try deleting it from your calculator and COPY and PASTE the code above like I did. Tom L Cui bono? |
|||
06-19-2024, 01:48 PM
(This post was last modified: 06-19-2024 01:49 PM by ftneek.)
Post: #5
|
|||
|
|||
RE: QROOT Program creates Syntax Error
(06-19-2024 01:24 PM)MullenJohn Wrote: Could you consider why my HP Prime calculator gives the error message “Syntax error in program line 8”? It appears the issue is the type of quotation mark used. Try "Roots are real." instead of “Roots are real.”, which should prevent the syntax error. - neek |
|||
06-19-2024, 03:02 PM
Post: #6
|
|||
|
|||
RE: QROOT Program creates Syntax Error
Thank you, Neek and Tom!
I used the quote marks under key [SHIFT] [9]. I changed to the quote marks under [ALPHA] [0], and it worked like a charm! The syntax error is gone. I couldn't have done it without your help. Program works now. Thank you for your insight on the quotation marks. Cheers! |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)