• Informatica
• # Listato di un programma in Just Basic. (228718)

###### Luchs - Ominide - 3 Punti

Buongiorno! C'è qualcuno che sa dirmi perché questo code scritto in Just Basic funziona per una sola variabile stringa e non per più variabili? Code:
sb1$(1) = "'I have no data yet. It is a capital mistake to theorize before one has data. Insensibly one begins to twist facts to suit theories, instead of theories to suit facts. But the note itself. What do you deduce from it?'"+chr$(13)+chr$(10)+"I carefully examined the writing, and the paper upon which it was written." i = 1 vtot$ = sb1$(i):lvtot = len(vtot$)
num = 0
for x = 1 to lvtot
if mid$(vtot$,x,1) = chr$(13) then num = num + 1 next x aa = 1:ii = 1 [a] for jj = aa to lvtot if mid$(vtot$,jj,1) &lt;> chr$(13) then kk = kk + 1:else goto next jj print aa ii = ii + 1 aa = aa + kk + 2 meaa(ii) = aa - 1 if ii &lt;= num + 1 then kk = 0:goto [a] tot$= sb1$(i):ltot = len(tot$) [Test_chr13_a$] for jj = 1 to ltot if mid$(sb1$(i),jj,1) = chr$(13) then a$ = left$(sb1$(i),jj-1):goto [Length_a1$] next jj [Length_a1$] if len(a$) &lt; 164 then a1$ = a$:lp = len(a$) - 2:sb1$(i) = right$(sb1$(i),ltot - lp):goto [Test_chr13_b$] [Len_a$_Max] a$ = left$(a$,164) if right$(a$,1) &lt;> chr$(32) then [Loop_a$] [Loop_a$] cont = 0:rac = 0:rim$ = "":inv$= "" for k = 164 to 1 step-1 if mid$(a$,k,1) &lt;> chr$(32) then rac = rac + 1:rim$= rim$ + mid$(a$,k,1):else [Swap_a1$] next k [Swap_a1$] a1$= left$(a$,164 - rac) for kk = len(rim$) to 1 step-1 inv$= inv$ + mid$(rim$,kk,1) next kk l1 = len(a1$) a2$ = mid$(tot$,l1 + 1,meaa(2) - l1) [Length_a2$] if len(a2$) &lt; 164 then lr = len(a2$):goto [Test_chr13_b$] if len(a2$) > 164 then ma2$ = a2$:l2v = len(a2$):goto [Len_a2$_Max] [Len_a2$_Max] a2$= left$(a2$,164) if right$(a2$,1) &lt;> chr$(32) then [Loop_a2$] [Loop_a2$] cont = 0:rac = 0:rim$= "":inv$ = "" for k = 164 to 1 step-1 if mid$(a2$,k,1) &lt;> chr$(32) then rac = rac + 1:rim$ = rim$+ mid$(a2$,k,1):else [Swap_a2$] next k [Swap_a2$] a2$ = left$(a2$,164 - rac) for kk = len(rim$) to 1 step-1 inv$ = inv$+ mid$(rim$,kk,1) next kk l2n = len(a2$) a3$= right$(ma2$,meaa(2) - l1 - l2n) [Test_chr13_b$] sb1$(i) = mid$(tot$,meaa(2) + 1,ltot - len(a1$) - len(a2$) - len(a3$)) b$= sb1$(i) for jj = 1 to ltot if mid$(sb1$(i),jj,1) = chr$(13) then b$ =left$(sb1$(i),jj-1):goto [Length_b1$] next jj [Length_b1$] if len(b$) &lt; 164 then b1$ = b$:lp = len(b$) - 2:sb1$(i) = right$(sb1$(i),ltot - lp):goto [Test_chr13_c$] [Len_b$_Max] b$ = left$(b$,164) if right$(b$,1) &lt;> chr$(32) then [Loop_b$] [Loop_b$] cont = 0:rac = 0:rim$ = "":inv$= "" for k = 164 to 1 step-1 if mid$(b$,k,1) &lt;> chr$(32) then rac = rac + 1:rim$= rim$ + mid$(b$,k,1):else [Swap_b1$] next k [Swap_b1$] b1$= left$(b$,164 - rac) for kk = len(rim$) to 1 step-1 inv$= inv$ + mid$(rim$,kk,1) next kk l1 = len(b1$) b2$ = mid$(tot$,meaa(2) + len(b1$),ltot - len(a1$) - len(a2$) - len(a3$) - len(b1$)) [Length_b2$] if len(b2$) &lt; 164 then lr = len(b2$) - 2:sb1$(i) = right$(sb1$(i),ltot - len(b1$) - len(b2$)):goto [Test_chr13_c$] if len(b2$) > 164 then mb2$ = b2$:l2v = len(b2$):goto [Len_b2$_Max] [Len_b2$_Max] b2$= left$(b2$,164) if right$(b2$,1) &lt;> chr$(32) then [Loop_b2$] [Loop_b2$] cont = 0:rac = 0:rim$= "":inv$ = "" for k = 164 to 1 step-1 if mid$(b2$,k,1) &lt;> chr$(32) then rac = rac + 1:rim$ = rim$+ mid$(b2$,k,1):else [Swap_b2$] next k [Swap_b2$] b2$ = left$(b2$,164 - rac) for kk = len(rim$) to 1 step-1 inv$ = inv$+ mid$(rim$,kk,1) next kk l2n = len(b2$) b3$= right$(mb2$,meaa(2) - l1 - l2n) [Test_chr13_c$] if num = 1 or num = 2 then [Result] sb1$(i) = mid$(tot$,meaa(3) + 1,ltot - meaa(3)) c$ = sb1$(i) for jj = 1 to ltot if mid$(sb1$(i),jj,1) = chr$(13) then c$=left$(sb1$(i),jj-1):goto [Length_c1$] next jj [Length_c1$] if len(c$) &lt; 164 then c1$= c$:lp = len(c$) - 2:sb1$(i) = right$(sb1$(i),ltot - lp):goto [Test_chr13_d$] [Len_c$_Max] c$= left$(c$,164) if right$(c$,1) &lt;> chr$(32) then [Loop_c$] [Loop_c$] cont = 0:rac = 0:rim$= "":inv$ = "" for k = 164 to 1 step-1 if mid$(c$,k,1) &lt;> chr$(32) then rac = rac + 1:rim$ = rim$+ mid$(c$,k,1):else [Swap_c1$] next k [Swap_c1$] c1$ = left$(c$,164 - rac) for kk = len(rim$) to 1 step-1 inv$ = inv$+ mid$(rim$,kk,1) next kk l1 = len(c1$) c2$= mid$(tot$,l1 + 1,meaa(3) - l1) [Length_c2$] if len(c2$) &lt; 164 then lr = len(c2$) - 2:sb1$(i) = right$(sb1$(i),ltot - len(c1$) - len(c2$)):goto [Test_chr13_d$] if len(c2$) > 164 then mc2$ = c2$:l2v = len(c2$):goto [Len_c2$_Max] [Len_c2$_Max] c2$= left$(c2$,164) if right$(c2$,1) &lt;> chr$(32) then [Loop_c2$] [Loop_c2$] cont = 0:rac = 0:rim$= "":inv$ = "" for k = 164 to 1 step-1 if mid$(c2$,k,1) &lt;> chr$(32) then rac = rac + 1:rim$ = rim$+ mid$(c2$,k,1):else [Swap_c2$] next k [Swap_c2$] c2$ = left$(c2$,164 - rac) for kk = len(rim$) to 1 step-1 inv$ = inv$+ mid$(rim$,kk,1) next kk l2n = len(c2$) c3$= right$(mc2$,meaa(3) - l1 - l2n) [Test_chr13_d$] if num = 1 or num = 2 or num = 3 then [Result] sb1$(i) = mid$(tot$,meaa(4) + 1,ltot - meaa(4)) d$ = sb1$(i) for jj = 1 to ltot if mid$(sb1$(i),jj,1) = chr$(13) then d$=left$(sb1$(i),jj-1):goto [Length_d1$] next jj [Length_d1$] if len(d$) &lt; 164 then d1$= d$:lp = len(d$) - 2:sb1$(i) = right$(sb1$(i),ltot - lp):goto [Test_chr13_e$] [Len_d$_Max] d$= left$(d$,164) if right$(d$,1) &lt;> chr$(32) then [Loop_d$] [Loop_d$] cont = 0:rac = 0:rim$= "":inv$ = "" for k = 164 to 1 step-1 if mid$(d$,k,1) &lt;> chr$(32) then rac = rac + 1:rim$ = rim$+ mid$(d$,k,1):else [Swap_d1$] next k [Swap_d1$] d1$ = left$(d$,164 - rac) for kk = len(rim$) to 1 step-1 inv$ = inv$+ mid$(rim$,kk,1) next kk l1 = len(d1$) d2$= mid$(tot$,l1 + 1,meaa(4) - l1) [Length_d2$] if len(d2$) &lt; 164 then lr = len(d2$) - 2:sb1$(i) = right$(sb1$(i),ltot - len(d1$) - len(d2$)):goto [Test_chr13_e$] if len(d2$) > 164 then md2$ = d2$:l2v = len(d2$):goto [Len_d2$_Max] [Len_d2$_Max] d2$= left$(d2$,164) if right$(d2$,1) &lt;> chr$(32) then [Loop_d2$] [Loop_d2$] cont = 0:rac = 0:rim$= "":inv$ = "" for k = 164 to 1 step-1 if mid$(d2$,k,1) &lt;> chr$(32) then rac = rac + 1:rim$ = rim$+ mid$(d2$,k,1):else [Swap_d2$] next k [Swap_d2$] d2$ = left$(d2$,164 - rac) for kk = len(rim$) to 1 step-1 inv$ = inv$+ mid$(rim$,kk,1) next kk l2n = len(d2$) d3$= right$(md2$,meaa(4) - l1 - l2n) [Test_chr13_e$] sb1$(i) = mid$(tot$,meaa(5) + 1,ltot - meaa(5)) e$ = sb1$(i) for jj = 1 to ltot if mid$(sb1$(i),jj,1) = chr$(13) then e$=left$(sb1$(i),jj-1):goto [Length_e1$] next jj [Length_e1$] if len(e$) &lt; 164 then e1$= e$:lp = len(e$) - 2:sb1$(i) = right$(sb1$(i),ltot - lp):goto [Result] [Len_e$_Max] e$ = left$(e$,164) if right$(e$,1) &lt;> chr$(32) then [Loop_e$] [Loop_e$] cont = 0:rac = 0:rim$ = "":inv$= "" for k = 164 to 1 step-1 if mid$(e$,k,1) &lt;> chr$(32) then rac = rac + 1:rim$= rim$ + mid$(e$,k,1):else [Swap_e1$] next k [Swap_e1$] e1$= left$(e$,164 - rac) for kk = len(rim$) to 1 step-1 inv$= inv$ + mid$(rim$,kk,1) next kk l1 = len(e1$) e2$ = mid$(tot$,l1 + 1,meaa(5) - l1) [Length_e2$] if len(e2$) &lt; 164 then lr = len(e2$) - 2:sb1$(i) = right$(sb1$(i),ltot - len(e1$) - len(e2$)):goto [Result] if len(e2$) > 164 then me2$ = e2$:l2v = len(e2$):goto [Len_e2$_Max] [Len_e2$_Max] e2$= left$(e2$,164) if right$(e2$,1) &lt;> chr$(32) then [Loop_e2$] [Loop_e2$] cont = 0:rac = 0:rim$= "":inv$ = "" for k = 164 to 1 step-1 if mid$(e2$,k,1) &lt;> chr$(32) then rac = rac + 1:rim$ = rim$+ mid$(e2$,k,1):else [Swap_e2$] next k [Swap_e2$] e2$ = left$(e2$,164 - rac) for kk = len(rim$) to 1 step-1 inv$ = inv$+ mid$(rim$,kk,1) next kk l2n = len(e2$) e3$= right$(me2$,meaa(5) - l1 - l2n) [Result] if a1$ &lt;> "" then print "a1$= ";a1$ if a2$&lt;> "" then print "a2$ = ";a2$if a3$ &lt;> "" then print "a3$= ";a3$ if b1$&lt;> "" then print "b1$ = ";b1$if b2$ &lt;> "" then print "b2$= ";b2$ if b3$&lt;> "" then print "b3$ = ";b3$if c1$ &lt;> "" then print "c1$= ";c1$ if c2$&lt;> "" then print "c2$ = ";c2$if c3$ &lt;> "" then print "c3$= ";c3$ if d1$&lt;> "" then print "d1$ = ";d1$if d2$ &lt;> "" then print "d2$= ";d2$ if d3$&lt;> "" then print "d3$ = ";d3$if num = 4 and e1$ &lt;> "" then print "e1$= ";e1$ if num = 4 and e2$&lt;> "" then print "e2$ = ";e2$if num = 4 and e3$ &lt;> "" then print "e3$= ";e3$ end

Questo topic è bloccato, non sono ammesse altre risposte.
Come guadagno Punti nel Forum? Leggi la guida completa
In evidenza
Classifica Mensile
Vincitori di agosto
Vincitori di agosto
Community Live

Partecipa alla Community e scala la classifica

andrea1085 Blogger 1873 Punti

VIP

Segui la Tv dello studente! Vedi tutti i video