Hey guys,
I'm trying to make a program that should be fairly simple. It's just a fancy way of displaying the quadratic formula. By pressing up and down, you should be able to insert A, B and C. However, I have a few problems. Anyone who can help me?
Code:
The
Code:
is something I read on the internet to prevent the program from randomly stopping itself. However, this causes the answers for X never to update. It also has some other bugs with displaying and entering A, B and C. Since i just got into programming with BASIC, I'm completely lost. Does anyone know how I can fix my horrible, chunky code? :S
I'm trying to make a program that should be fairly simple. It's just a fancy way of displaying the quadratic formula. By pressing up and down, you should be able to insert A, B and C. However, I have a few problems. Anyone who can help me?
Code:
0→U:0→D:0→Y:0→Z:0→K
Lbl A
ClrHome
Output(2,3,B
Output(2,1,"B=")
Output(3,3,C
Output(3,1,"C=")
Output(5,3,D
Output(5,1,"D=
Output(7,3,Y
Output(7,1,"X=
Output(8,1,"OR
Output(9,3,Z
Output(9,1,"X=
Input "A=",A
B²-4AC→D
If D<0:Then
Output(1,3,A
Output(1,1,"A
Output(2,3,B
Output(2,1,"B=")
Output(3,3,C
Output(3,1,"C=")
Output(5,1,"D<0"
If 0=0:Then
Goto K
Else
Goto K
Else
((B)-√(D))/(2*A)→Y
((B)+√(D))/(2*A)→Z
If Y=Z:Then
Output(1,3,A
Output(1,1,"A
Output(2,3,B
Output(2,1,"B=")
Output(3,3,C
Output(3,1,"C=")
Output(5,3,D
Output(5,1,"D=
Output(7,3,Y
Output(7,1,"X=
Else
Output(1,3,A
Output(1,1,"A=
Output(2,3,B
Output(2,1,"B=")
Output(3,3,C
Output(3,1,"C=")
Output(5,3,D
Output(5,1,"D=
Output(7,3,Y
Output(7,1,"X=
Output(8,1,"OR
Output(9,3,Z
Output(9,1,"X=
End
End
1→U
If 0=0:Then
Goto K
Else
Goto K
Lbl K
0→K
getKey→K
If K=0
Goto K
If K=25 and U=3
Goto A
If K=25 and U=2
Goto C
If K=25 and U=1
Goto B
If K=34 and U=3
Goto B
If K=34 and U=1
Goto C
If K=34 and U=2
Goto A
If K=45
Goto Q
If K=105 and U=1
Goto A
If K=105 and U=2
Goto B
If K=105 and U=3
Goto C
If U=0
1→U
Lbl B
ClrHome
Output(2,3,C
Output(2,1,"C=")
Output(3,3,A
Output(3,1,"A=")
Output(5,3,D
Output(5,1,"D=
Output(7,3,Y
Output(7,1,"X=
Output(8,1,"OR
Output(9,3,Z
Output(9,1,"X=
Input "B=",B
B²-4AC→D
If D<0:Then
B²-4AC→D
If D<0:Then
Output(1,3,A
Output(1,1,"A
Output(2,3,B
Output(2,1,"B=")
Output(3,3,C
Output(3,1,"C=")
Output(5,1,"D<0"
Goto K
Else
((B)-√(D))/(2*A)→Y
((B)+√(D))/(2*A)→Z
Goto 99
Else
Goto 99
Lbl 99
If Y=Z:Then
Output(1,3,A
Output(1,1,"A
Output(2,3,B
Output(2,1,"B=")
Output(3,3,C
Output(3,1,"C=")
Output(5,3,D
Output(5,1,"D=
Output(7,3,Y
Output(7,1,"X=
Goto 69
Else
Goto 69
Lbl 69
Else
Output(1,3,B
Output(1,1,"B=
Output(2,3,C
Output(2,1,"C=")
Output(3,3,A
Output(3,1,"A=")
Output(5,3,D
Output(5,1,"D=
Output(7,3,Y
Output(7,1,"X=
Output(8,1,"OR
Output(9,3,Z
Output(9,1,"X=
Goto 44
Else
Goto 44
Lbl 44
End
End
Goto 55
Else
Goto 55
Lbl 55
2→U
If 0=0:Then
Goto K
Else
Goto K
Lbl C
ClrHome
Output(2,3,A
Output(2,1,"A=")
Output(3,3,B
Output(3,1,"B=")
Output(5,3,D
Output(5,1,"D=
Output(7,3,Y
Output(7,1,"X=
Output(8,1,"OR
Output(9,3,Z
Output(9,1,"X=
Input "C=",C
B²-4AC→D
If D<0:Then
B²-4AC→D
If D<0:Then
Output(1,3,A
Output(1,1,"A
Output(2,3,B
Output(2,1,"B=")
Output(3,3,C
Output(3,1,"C=")
Output(5,1,"D<0"
If 0=0:Then
Goto K
Else
Goto K
Else
((B)-√(D))/(2*A)→Y
((B)+√(D))/(2*A)→Z
If Y=Z:Then
Output(1,3,A
Output(1,1,"A
Output(2,3,B
Output(2,1,"B=")
Output(3,3,C
Output(3,1,"C=")
Output(5,3,D
Output(5,1,"D=
Output(7,3,Y
Output(7,1,"X=
If 0=0:Then
Goto K
Else
Goto K
Else
Output(1,3,C
Output(1,1,"C=
Output(2,3,A
Output(2,1,"A=")
Output(3,3,B
Output(3,1,"B=")
Output(5,3,D
Output(5,1,"D=
Output(7,3,Y
Output(7,1,"X=
Output(8,1,"OR
Output(9,3,Z
Output(9,1,"X=
End
End
3→U
If 0=0:Then
Goto K
Else
Goto K
Lbl Q
ClrHome
The
Code:
Goto K
Else
Goto K
is something I read on the internet to prevent the program from randomly stopping itself. However, this causes the answers for X never to update. It also has some other bugs with displaying and entering A, B and C. Since i just got into programming with BASIC, I'm completely lost. Does anyone know how I can fix my horrible, chunky code? :S