Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Author Message
lapo3399

Posted: Sun Nov 21, 2004 2:35 pm   Post subject: QUADRATIC SOLVER

Heres a program I made (i just learned turing today) for solving quadratic equations in math. Just enter the a, b, and c values and itll give u the roots. (y=ax**2+bx+[b]c[/b
WARNING!!!-THE PROGRAM MAY HAVE AN ERROR IF THERE ARE NO REAL ROOTS

Description:
Filesize:  564 Bytes

Tony

Posted: Sun Nov 21, 2004 3:33 pm   Post subject: (No subject)

don't you mean
 code: e:=(b**2-4*a*c)     if e<0 then     put "There are no real roots"

because otherwise (sqrt(e)) the program will crash.

its a good start, but now you should try to encorporate all of the roots. Its not that hard. Here's a hit

 code: if e<0 then e *= -1 flagi := true

and here you go - squareroot part becomes possitive, you just got to keep in mind that you have to add in "i" later on (but flagi is marked as true to remind you)
Tony's programming blog. DWITE - a programming contest.
Andy

Posted: Sun Nov 21, 2004 8:09 pm   Post subject: (No subject)

heh i wrote one on my ti83 that can do the unreal roots.. too bad i lost it :'(
Tony

Posted: Sun Nov 21, 2004 8:42 pm   Post subject: (No subject)

I had lots of stuff on my TI83.. you know how you used to have to do dozens of the same problems over and over with different numbers? yeah - just solve once for the variable values instead, and write down the function in TI
Tony's programming blog. DWITE - a programming contest.
Andy

Posted: Mon Nov 22, 2004 4:21 pm   Post subject: (No subject)

heh yea.. same here
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 5 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: