Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Pythagorean Theorem - ASP VBSscript
Closed Thread
Old 02-08-2004, 09:50 PM   #1 (permalink)
 
Wizard Techie

Join Date: Jul 2003

Posts: 3,940

ekÆsine

Default Pythagorean Theorem - ASP VBSscript

i'm writing an ASP program using VBScript style (i really don't know what it is called). i am very new to all of this so i do not understand much. the problem is given 2 sides calculate the third side of a right triangle.

i know the math formula, i do not know how to write it with VBScript. in case you do not know Pythagorean Theorem i will include it:

Pythagorean Theorem = A²+B²=C²
A & B are legs, C is the hypotenuse
say A=3, B=2, C=unknown. to find out C i would:
3²+2²=C²
9+4=C²
13=C²

so to isolate C by itself i must get the square root of C...i think, i am not sure. the square root symbol looks like a checkmark with a long trailing end.

the book i am using is SAM's teach yourself ASP in 24 hours which is a very bad book, confusing as ****. it even says at the preface: no VBScript knowledge required, total BS.

here is what i have so far. i am completely confused:
PHP Code:
<%@LANGUAGE="VBScript"%>
<%
created by Bruce Nguyen
Option Explicit
Response
.Expires 0
Dim LegA
LegBHypotenusemHypotmLeg

If Request.ServerVariables("QUERY_STRING") <> "" Then
LegA 
=  Trim(Request.QueryString("legone"))
LegB =  Trim(Request.QueryString("legtwo"))
Hypotenuse =  Trim(Request.QueryString("hypot"))
%>

<%
mHypot Sqr(LegA) + Sqr(LegB)
mHypot Sqr(mHypot
mHypot = %>

<
HTML><BODY>
[
b]You Entered this Value for Leg A:[/b]  <%= LegA %>


[
b]You Entered this Value for Leg B:[/b]  <%= LegB %>


[
b]You Entered this Value for the Hypotenuse:[/b]  <%= Hypotenuse %>


[
b]The Hypotenuse is:[/b]  <%= mHypot %>


[
b]The QUERY_STRING is:[/b] <%= Request.ServerVariables("QUERY_STRING") %>


[
url="../"]Go Back[/url]
</
BODY></HTML>
<%
Else
%>
<
HTML><BODY>
[
B]Right Triangle Calculator[/B]

<
FORM ACTION="<%= Request.ServerVariables("SCRIPT_NAME") %>" METHOD="GET">
<
font color="#0000FF"><font size="2">Enter a Number for Two Known SidesEnter Zero (0) for the Unknown Side</font></font>


Length of Leg A: <INPUT TYPE="Text" NAME="legone" >


Length of Leg B: <INPUT TYPE="Text" NAME="legtwo" >


Length of Hypotenuse: <INPUT TYPE="Text" NAME="hypot" >



<
INPUT TYPE="Submit" NAME="submit" VALUE="Calculate Missing Side">
<
INPUT TYPE="reset" NAME="reset" Value="Reset">
</
FORM>
</
BODY></HTML>


<% 
End If %> 
-edit
hmm, i think i figured it out maybe it is just
missing hypotenuse= mHypot
mHypot=(A*A) + (B*B)
mHypot=sqr(mHypot)

i hate math
ekÆsine is offline  
 
Closed Thread

Thread Tools
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 On