I know that you have completed the program already, but I would like to promote simpler and nice programming techniques, so here's my take on the program. You input the string, and then press a key to select which letter you want to guess, and then press enter to show which ones are selected. It's just up to you know to display which ones have already been guessed... Which is relatively easy with this. If you have MathPrint, I would suggest making it Classic. I probably am not going to explain this to much as it has already been uploaded, but it can be used for the future I guess. Hope this helps!
I can explain it more, but it doesn't sound like you need it. Enjoy though!
Code:
EDIT: Also, Haobo, this:
Code:
Can be:
Code:
(I just really enjoy optimization, sorry. )
I can explain it more, but it doesn't sound like you need it. Enjoy though!
Code:
ClrHome
Input "",Str0
DelVar C" ->Str1:" "+Str0+" ->Str0
0->R
Repeat R
ClrHome
1->A:Ans->D:Ans->R
For(X,1,10
A+1->B
inString(Str0," ",Ans->A
If Ans:Then
Disp "
For(Z,1,A-B
sub(Str0,B+Z-1,1
If not(inString(Str1,Ans
Then:0->R:"-
End
Output(X,Z,Ans
End:Else
X->D
10->X:End:End
If R:Then
Pause "YOU WIN!
Else
Disp "ENTER GUESS:
0
Repeat Ans=105
Repeat Ans>40
getKey:End
If Ans!=105:Then
sub("ABC DEFGHIJKLMNOPQRSTUVWXYZ ",Ans-5int(.1Ans+4),1->Str2
Output(D+2,1,Ans:0:End
End
Str2+Str1->Str1
End
End:ClrHome
EDIT: Also, Haobo, this:
Code:
If L1(A)
Then
Output(A,1,sub(Str0,A,1))
Else
Output(A,1,"-")
End
Can be:
Code:
sub(Str0,A,1
If not(L1(A:"-
Output(A,1,Ans