This skin was created by The Future and Robb of the IF Skin Zone

Free Forums. Reliable service with over 8 years of experience.
InvisionFree - Free Forum Hosting
Welcome to iCode. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Name:   Password:


Pages: (2) [1] 2  ( Go to first unread post )

 Solve quadratic equations, Using VB of course
salism2
Posted: Dec 14 2005, 08:40 PM


Member of Icode
Group Icon

Group: Admin
Posts: 30
Member No.: 2
Joined: 25-October 05



ok, here is the code....
i could try to make it solve x^3 equations or even x^5...I know u gonna find it easy but not the maths wtf.gif

PS: U should already know how 2 solve quadratic equations to understand this code,

First add 3 textboxes named: txtx2, txtx and txtc, also add a label called lblsolution

Option Explicit

Public a As Double
Public b As Double
Public c As Double
Public discriminant As Double
Public sol1 As Double
Public sol2 As Double
____________________________________________

Private Sub cmdsolve_Click()
a = Val(txtx2.Text)
b = Val(txtx.Text)
c = Val(txtc.Text)
discriminant = b ^ 2 - (4 * a * c)
If discriminant < 0 Then
lblsolution.Caption = "There is no solution !"
ElseIf discriminant = 0 Then
sol1 = (-b ) / (2 * a)
lblsolution.Caption = "Solution: " & "x= " & Format(sol1, "0.0000")
Else
sol1 = (-b + Sqr(discriminant)) / (2 * a)
sol2 = (-b - Sqr(discriminant)) / (2 * a)
lblsolution.Caption = "Solution: " & "either: x= " & Format(sol1, "0.0000") & vbCrLf & " or: x= " & Format(sol2, "0.0000")
'Do you have any better suggestions for rounding up the numbers? 3 or 4 dp would do.
End If
End Sub
____________________________________________
Good Luck ninja.gif
.if u need me to explain anything, just say Tip-Hat.gif
user posted image


--------------------

Top
baller_tk
Posted: Dec 14 2005, 09:16 PM


Administrator
Group Icon

Group: Admin
Posts: 227
Member No.: 1
Joined: 25-October 05



he is our mathamatition :S, good work islam! but im not sure anyone gets what u mean man tongue.gif


--------------------
user posted image
Top
salism2
Posted: Dec 14 2005, 10:00 PM


Member of Icode
Group Icon

Group: Admin
Posts: 30
Member No.: 2
Joined: 25-October 05



No offence but people in this Forum seem to be all happy no problems...angry.gif
Thnx btw victory.gif


--------------------

Top
timeshifter
Posted: Dec 15 2005, 10:42 PM


Member of Icode


Group: Members
Posts: 15
Member No.: 45
Joined: 12-December 05



mathematician?

If he really was a mathematician, then he'd create a quick program that could calcluate x^n equations where the user enters n, or how many pieces there are...

It's not that difficult.
Top
baller_tk
Posted: Dec 16 2005, 10:46 AM


Administrator
Group Icon

Group: Admin
Posts: 227
Member No.: 1
Joined: 25-October 05



sorry about my english wink.gif
U love to critisise ppl dont u :S


--------------------
user posted image
Top
timeshifter
Posted: Dec 16 2005, 04:50 PM


Member of Icode


Group: Members
Posts: 15
Member No.: 45
Joined: 12-December 05



Please... it's constructive criticism.

I'm telling you people what you can be doing to make your code all that much better and more efficient than what you're posting.


Just a little FYI, I was taking college-level calculus courses in high school...
Top
baller_tk
Posted: Dec 16 2005, 06:09 PM


Administrator
Group Icon

Group: Admin
Posts: 227
Member No.: 1
Joined: 25-October 05



hey some one actaully knows maths here biggrin.gif


--------------------
user posted image
Top
salism2
Posted: Dec 16 2005, 06:10 PM


Member of Icode
Group Icon

Group: Admin
Posts: 30
Member No.: 2
Joined: 25-October 05



im sorry man i won't do it again....


--------------------

Top
Psychopathetica
Posted: Dec 16 2005, 09:34 PM


Member of Icode


Group: Members
Posts: 27
Member No.: 46
Joined: 12-December 05



We VBForum.com addicts, such as timeshifter and myself, are very talented programmers who know our stuff. Criticism is a harsh way to put it. More like "helping you out" or "help on coding it better".

And yes we are REALLY REALLY addicted to vbforums. I literally spend 99% of my internet time on that site alone. RobDog888 and dglienna are literally posting 24/7 on there too laugh.gif
Top
baller_tk
Posted: Dec 16 2005, 09:48 PM


Administrator
Group Icon

Group: Admin
Posts: 227
Member No.: 1
Joined: 25-October 05



hehe im like that to pixel2life.com


--------------------
user posted image
Top
salism2
Posted: Dec 17 2005, 08:59 PM


Member of Icode
Group Icon

Group: Admin
Posts: 30
Member No.: 2
Joined: 25-October 05



u know what......Get a life tongue.gif


--------------------

Top
salism2
Posted: Dec 18 2005, 11:50 AM


Member of Icode
Group Icon

Group: Admin
Posts: 30
Member No.: 2
Joined: 25-October 05



Only testing...

HTML
<p><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="100" width="100"></p>
<param name="autostart" value="false">
<param name="src" value="http://www.thefanellis.com/wordpress/wp-images/babyheartbeat.mp3">
<param name="controller" value="true">
<embed height="50" pluginspage="http://www.apple.com/quicktime/download/" src="http://www.thefanellis.com/wordpress/wp-images/babyheartbeat.mp3" type="audio/mpeg" width="100" controller="true" autoplay="false" autostart="false"><br />
</embed></param></param></param></object> </p>


--------------------

Top
Dr.Younker
  Posted: Apr 19 2006, 04:35 AM


n00b Icode'er


Group: Members
Posts: 4
Member No.: 73
Joined: 18-April 06



ok guys, well this seems to be a semilar question that i was faced with.
how would you write a program for a questions like these?

Write a program that solves a quadratic equation AX2 + Bx +C =0, i.e., find x fir A, B, C. Ask the user to enter the values of A, B, C and display the two values of x. you must also check if you are going to find the square root of a negative value. F you have to find the square root of negative values, multiply by (-1), find the square root and express the result as real and imaginary (complex number). You should also produce a flowchart of your algorithm.

And Write a program that inputs up to 15 temperatures in degrees Fahrenheit and converts it to Celsius using C=9/5F + 32. Express in degree F. Display in a picture box each Fahrenheit and the corresponding Celsius in deg.C
Top
baller_tk
Posted: Apr 19 2006, 09:24 PM


Administrator
Group Icon

Group: Admin
Posts: 227
Member No.: 1
Joined: 25-October 05



Well Dr younker this will solve your first problem, jus follow the tutorial above, seems to me that this is your homework unsure.gif

now i would love to help you but dont expect us to give you all the answers, you have to learn it the hard way jus like everyone else... anyway here is a link for a program to download to convert from Celcius to Fahrenheit:
http://pscode.com/vb/scripts/ShowZip.asp?l...=tp%2FC72568041
but make sure you look at the code not just copy it

Mukhtar


--------------------
user posted image
Top
Dr.Younker
Posted: Apr 19 2006, 09:43 PM


n00b Icode'er


Group: Members
Posts: 4
Member No.: 73
Joined: 18-April 06



i understand where your coming from baller_tk, cuz i really want to be a master at this one day, and i know the only way to do that is to work hard at it. so trust me i will be breaking my neck to learn this.

and the example i gave is not really my home to give in, its really an example our lecturer gave us and said that our finals which is in the next 3 weeks will come very semilar to those two questions, so am trying to get help with them so that i can handle any other questions that should be coming for finals. all i need to do is to get a understanding as to write different programs.

i really wish my lecture would go through step by step questions with the class, instead of just putting example questions in front of us and then tell us to look them up, to me what he is trying to say is learn on your own.
Top
DealsFor.me - The best sales, coupons, and discounts for you

Topic OptionsPages: (2) [1] 2 



Hosted for free by InvisionFree* (Terms of Use: Updated 2/10/2010) | Powered by Invision Power Board v1.3 Final © 2003 IPS, Inc.
Page creation time: 0.1430 seconds | Archive
Affiliates

Hits we had today, 2006!