Re: Arrange them [ updated ]
- From: dan73 <fasttrack2a@xxxxxxx>
- Date: Fri, 21 Nov 2008 10:22:20 EST
Cobra wrote:
Thanks for the 'algorithm'
want to know one thing here,
can we again get the 'original sequence' back ? by this >procedure.
A lot less code than I thought!
I still can not understand your logic but here is the
new program that destroys A$ after it is retrieved by an
array in the first "I" loop on line 40.
This I loop also gives the two variables X and X1 there
values.
If A$ is destroyed in line 100 without rebuilding it first
the integrity of the original A$ is lost it cannot be
rebuilt from just the pairing values of X and X1.
Please enlighten me on your logic in all of this?
Are you investigating some sort of encryption method?
10 CLS
20 DIM B1$(34)
30 A$="1101100101101110010001000011110101":PRINT A$
40 FOR I=1 TO 34
50 REM I value at it's greatest equals the length of the string.
60 B$=MID$(A$,I,1)
70 IF B$="1" THEN X=X+1:B1$(I)="1":GOTO 90
80 X1=X1+1:B1$(I)="0"
90 NEXT I
100 PRINT "The pairing of this string is --":PRINT " ":A$=""
110 FOR I = 1 TO 18
120 REM (18) represents the total count of pairs and singles added together
140 IF X>0 AND X1>0 THEN PRINT "10 ";:X=X-1:X1=X1-1
150 IF X>0 AND X1=0 THEN PRINT "1 ";:X=X-1
160 IF X1>0 AND X=0 THEN PRINT "0 ";:Y=Y-1
170 NEXT I
190 PRINT " ":PRINT "New string values from array built
from first I loop on line 40 ="
200 FOR I=1 TO 34
210 PRINT B1$(I);
220 NEXT I
230 PRINT "": PRINT "Print A$";A$;" ---A$ was destroyed
on line 100 therefore now empty"
240 REM The only way to retrieve the original A$ before
its' destruction on line 100 is rebuild it in
the first I loop on line 40.
.
- Follow-Ups:
- Re: Arrange them [ updated ]
- From: Nimo
- Re: Arrange them [ updated ]
- References:
- Arrange them [ updated ]
- From: Nimo
- Arrange them [ updated ]
- Prev by Date: Re: Absolute Continuity
- Next by Date: Re: Arrange them [ updated ]
- Previous by thread: Re: Arrange them [ updated ] Correction!
- Next by thread: Re: Arrange them [ updated ]
- Index(es):
Relevant Pages
|