Quote: "all you have to do is punch in the height and the base, and it will be calculated for you."
Nope, sorry but it won't.
Your code doesn't really make a lot of sense nor is it a calculator since all 3 values need to be provided by the user.
You have:
C = C^2
Followed by:
C = A+B
Therefore making the first statement pointless. All the code really does is take all 3 values and returns the square root of the squared values, or in other words returning the same numbers the user already entered. Your hypotenuse value is taking the square root of the sum of the legs, when it should be taking the sum of the squared legs.
This:
A = A^2
B = B^2
A = sqrt(A)
B = sqrt(B)
C = sqrt(A+B)
Should be this:
A = A^2
B = B^2
C = sqrt(A+B)
A = sqrt(A)
B = sqrt(B)
Also, this code will always return true because those variables are never defined, thus always being an empty string which is not equal to "?".
What you should do, is allow the user to give 2 of the sides and let the program calculate the 3rd. So the user provides either one leg and the hypotenuse or just two legs. I would also recommend making the variables floats instead of integers if you wish to use decimal values.
Also, the program loops continuously unless the user specifically types "quit". Anything else will continue onward, making the conditional check for "continue" rather unnecessary. Provide information to the user so they know what proper values are accepted. Typically, something like this would accept either Y or N for such a question.
I'm not trying to sound offensive, but did you test your program? Because it simply won't return the correct value for C like you're expecting.
Here's some code to study.
do
cls
print "Right-triangle Calculator"
print "-------------------------"
input "What is the length of side A? ", A#
input "What is the length of side B? ", B#
input "What is the length of the hypotenuse? ", C#
rem if user didn't specify hypotenuse value,
rem assume both legs were entered
if C# = 0
C# = sqrt(A#^2 + B#^2)
rem Hypotenuse was given, calculate missing leg length
else
rem User supplied hypotenuse and leg B
if A# = 0
A# = sqrt(C#^2 - B#^2)
rem User supplied hypotenuse and leg A
else
B# = sqrt(C#^2 - A#^2)
endif
endif
print ""
print "Answer:"
print "The length of leg A is: ", A#
print "The length of leg A is: ", B#
print "The length of the hypotenuse is: ", C#
print ""
rem Repeat the question until the user provides an acceptable answer
repeat
input "Do you wish to quit or continue (Y/N)? ", action$
until upper$(action$) = "N" or upper$(action$) = "Y"
rem Quit the program
if upper$(action$) = "N" then end
loop