Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-05-2013, 11:53 AM   #1
Beta Member
 
Join Date: Mar 2013
Location: nigerai
Posts: 1
Default please what do you think of my codes

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
__________________

uhexos is offline   Reply With Quote
Old 03-06-2013, 10:10 AM   #2
xxcobraxx
 
Join Date: Oct 2004
Location: England
Posts: 6,224
Default Re: please what do you think of my codes

Well done man, looking good, is this python? And how long does this take to learn?

Always wanted to program.
__________________

IAntDemo is offline   Reply With Quote
Old 03-06-2013, 11:58 AM   #3
Site Team
 
celegorm's Avatar
 
Join Date: Sep 2006
Posts: 10,713
Send a message via AIM to celegorm
Default Re: please what do you think of my codes

^ That looks more like visual basic, not python
__________________
"as a fanboy i refuse to admit it and will pull countless things out of my butt to disprove it"

Team Thelegorm! Total Kills: 21 (i iz in uor profile, editsing your sigz)
celegorm is offline   Reply With Quote
Old 03-08-2013, 06:08 AM   #4
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default Re: please what do you think of my codes

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 didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 03-09-2013, 11:32 AM   #5
xxcobraxx
 
Join Date: Oct 2004
Location: England
Posts: 6,224
Default Re: please what do you think of my codes

Thanks root.

Nicely said
IAntDemo is offline   Reply With Quote
Old 03-10-2013, 09:54 PM   #6
Solid State Member
 
Join Date: Mar 2013
Location: U.S.
Posts: 16
Default Re: please what do you think of my codes

Please ignore my response until i can figure out what is happening to my text response!
FloydV is offline   Reply With Quote
Old 03-17-2013, 02:11 PM   #7
In Runtime
 
Join Date: Feb 2013
Location: UK
Posts: 156
Default Re: please what do you think of my codes

Agree with root - definitely some flavour of BASIC.
_michaelm is offline   Reply With Quote
Old 03-17-2013, 06:44 PM   #8
Solid State Member
 
Join Date: Mar 2013
Location: U.S.
Posts: 16
Default Re: please what do you think of my codes

Quote:
Originally Posted by root View Post
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
__________________

FloydV is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 10:20 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0