TGC Codebase Backup



Pythagorean Theorem Calculator by Gold Falcon

16th Oct 2013 18:22
Summary

Skip all those steps of the process of determining the hypotenuse of a right-angle triangle. Just punch in the base and the height, and this script will find it for you!



Description

To find the hypotenuse of a right-angle triangle (C), you would have to use the formula "A^2 + B^2 = C^2", square them, then get the square root of C^2. Skip all these steps, just put the values for A and B (Height and Base), and the script will do all the mathematical functions for you!

Please give constructive criticism and feedback, as it is my first script, and I am just starting to learn DBPro.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    remstart
######################################
##  Pythagorean Theorem Calculator  ##
##  ==============================  ##
##  Created By: Gold Falcon         ##
######################################
remend

do
    cls
	input "What is the height of the triangle (A)? ";A
	input "What is the base of the triangle (B)? ";B
	input "If you have it, what is the hypotenuse (C)? ";C
	
	if a$<>"?" and b$<>"?"
    	A = A^2
    	B = B^2
    	C = C^2
    
		C = A+B
	
		A = sqrt(A)
		B = sqrt(B)
		C = sqrt(A+B)
	
		cls
		print "Therefore;"
		print "The height (A) is equal to [";a;"]"
		print "The base (B) is equal to [";b;"]"
		print "*** The hypotenuse (C) is equal to [";c;"]"
		print "------------------------"
		input "Do you wish to quit or continue? ";action$
		
		if action$ = "quit"
			end
		endif
		
		if action$ = "continue"
			`Do Nothing
		endif
	endif
loop