flyroyc
Joined: 13 Oct 2011 Posts: 2
|
Posted: October 13, 2011 2:47 PM Post subject: Weight and balance program for aircraft |
|
|
I wrote this because I simply could not find code written by someone else. It works well with one exception: I didn't know how to incorporate a way to escape or stop the program once it has started if the user wants to stop or accidently enters the wrong number for the for loop. anybody know how to do this?
| Code: | :Balance()
:Prgm
:ClrIO
:1→x
:0→m
:0→w
:
:Input “How many items?”,n
:For i,1,n,1
:Display “Item”,i
:Input “weight(lbs)?”,y
:y+w→w
:PopUp {“arm”,”moment”},c
:If c=1 Then
:Input “arm(in)?”,x
:x*y+m→m
:ElseIf c=2 Then
:Input “moment(in-lbs)?”,x
:x+m→m
:
:EndIf
:EndFor
:
:Disp “Total weight”,w
:Disp “Total moment”,m
:Disp “Arm”,m/w
:Lbl finish
:Pause
:Dialog
:DropDown “finished?”,{“add/remove item”,”back”,”done”},e
:EndDlog
:If e=1 Then
:Input “How many items to add/remove?”,y
:For i,1,n,1
:Display “Item”,i
:Input “weight(lbs)?”,y
:y+w→w
:PopUp {“arm”,”moment”},c
:If c=1 Then
:Input “arm(in)?”,x
:x*y+m→m
:ElseIf c=2 Then
:Input “moment(in-lbs)?”,x
:x+m→m
:
:EndIf
:EndFor
:
:Disp “Total weight”,w
:Disp “Total moment”,m
:Disp “Arm”,m/w
:Goto finish
:ElseIf e=2 Then
:Goto finish
:
:EndIf
:
:EndPrgm
|
|
|