I am making a program that will give C, A, B, and D of the equation Y=C+AcosB(θ-D) when you are given the graph. I have the base program down and it works but when I am not given a min or max it doesn't work. See pics of the problems I'm trying to solve at http://imgur.com/a/it1q1
C is found by averaging max and min
A is found by max minus C
B is found by 360/length of period
D is found by first max
In the beginning I need to ask if C is given and if it is I need to find either max or min and then continue the program.
Code:
The error I get is that when it gets to the else after Goto R in the code, is syntax.
Also, if I say that C is given it says done on the screen and nothing is executed.
C is found by averaging max and min
A is found by max minus C
B is found by 360/length of period
D is found by first max
In the beginning I need to ask if C is given and if it is I need to find either max or min and then continue the program.
Code:
output(4,1,"1 for yes
output(5,1,"0 for no
input "is C given? ",O
if O=1
then
clrhome
output(3,1,"1 for max
output(4,1,"2 for min
input "max or min given? ",K
input "C=",C
if K=1
then
input "max: ",X
2C-X→Y
else
input "min: ",Y
2C-Y→X
Goto R
else
(code that gets run if max and min are given)
Lbl R
(code after C is found)
The error I get is that when it gets to the else after Goto R in the code, is syntax.
Also, if I say that C is given it says done on the screen and nothing is executed.