please what do you think of my codes

uhexos

Beta member
Messages
1
Location
nigerai
please what do you think of my code and how can i make it better
DIM sel AS STRING
DO
CLS
PRINT "formula: y = a * x ^ 2 + b * x + c"
PRINT "enter values for a, b and c "

6 INPUT "Please enter a:", a!
IF a=0 THEN
PRINT "PLEASE INPUT ANOTHER VALUE FOR a"
GOTO 6
END IF
INPUT "Please enter b:", b!
INPUT "Please enter c:", c!

LET R= b! ^ 2 - 4 * a! * c!
PRINT "Discriminant ="; R
LET X1 = (-b! - SQR(R)) / (2 * a!)
LET X2 = (-b! + SQR(R)) / (2 * a!)
PRINT " x1 ="; X1
PRINT " x2 ="; X2
DO
INPUT "MAKE ANOTHER CALCULATION (Y/N):", sel
sel = UCASE$(sel)
LOOP UNTIL sel ="Y" OR sel = "N"
LOOP UNTIL sel= "N"
END
 
Well done man, looking good, is this python? And how long does this take to learn?

Always wanted to program.
 
what happens when b = 1

LET R= b! ^ 2 - 4 * a! * c!

R = 1 ^ - 4 (=-3) multiplied by a factorial multiplied by C factorial.

then I assume that the SQR(R) function is looking for the square root of R?
(which in this case will be an imaginary number?)

(i.e error checking the input B might be a good idea) try it and see how the code handles it.

this isn't python, it's definitely not Visual basic (as it's not visual and it has goto statements and line numbers...)

I *think* it's Q basic.
 
Please ignore my response until i can figure out what is happening to my text response!
 
Last edited:
what happens when b = 1

LET R= b! ^ 2 - 4 * a! * c!

R = 1 ^ - 4 (=-3) multiplied by a factorial multiplied by C factorial.

then I assume that the SQR(R) function is looking for the square root of R?
(which in this case will be an imaginary number?)

(i.e error checking the input B might be a good idea) try it and see how the code handles it.

this isn't python, it's definitely not Visual basic (as it's not visual and it has goto statements and line numbers...)

I *think* it's Q basic.

I was thinking that error checking for non-alphanumeric characters and alpha characters on each input would be a good idea.

Floyd
 
Back
Top Bottom