Delphi. Хочу чтоб нескольким элементам Edit задавалось одно значение.. Что не так? Почему не работает? begin for i := 2 to 12 do Editi.Visible:=false; end;
Попробуй Program PascalGuru; var s:string; f,t:text; function preobr(s:string):string;var i,j,p,n,sered:integer; gl,zp,slovo:string; m:array [1..80] of string;beginzp:='!?*,.'; gl:='аоуыэяеёюи'; p:=pos(' ',s); i:=0; repeat inc(i); slovo:=copy(s,1,p-1); m[i]:=slovo; delete(s,1,p); p:=pos(' ',s); until p=0; n:=i+1; m[n]:=s; for i:=1 to n do begin s:=m[i]; if pos(s[length(s)],zp)<>0 then p:=length(s)-1 else p:=length(s); sered:=(p div 2)+1; if (not odd(p)) or (p<3) then continue; if pos(s[1],gl)=0 then continue; if pos(s[sered],gl)=0 then continue; if pos(s[p],gl)=0 then continue; s[1]:=UpCase(s[1]); s[sered]:=UpCase(s[sered]); s[p]:=UpCase(s[p]); m[i]:=s+'('+s[1]+','+s[sered]+','+s[p]+')'; end; s:=''; for i:=1 to n do s:=s+m[i]+' '; preobr:=s;end; beginassign(f,'input.txt'); reset(f);assign(t,'output.txt'); rewrite(t); while not eof(f) do begin readln(f,s); writeln(t, preobr(s) ); end; writeln('Файл успешно записан...'); close(f);close(t);readln;end.
function preobr(s:string):string;var i,j,p,n,sered:integer; gl,zp,slovo:string; m:array [1..80] of string;beginzp:='!?*,.'; gl:='аоуыэяеёюи'; p:=pos(' ',s); i:=0; repeat inc(i); slovo:=copy(s,1,p-1); m[i]:=slovo; delete(s,1,p); p:=pos(' ',s); until p=0; n:=i+1; m[n]:=s; for i:=1 to n do begin s:=m[i]; if pos(s[length(s)],zp)<>0 then p:=length(s)-1 else p:=length(s); sered:=(p div 2)+1; if (not odd(p)) or (p<3) then continue; if pos(s[1],gl)=0 then continue; if pos(s[sered],gl)=0 then continue; if pos(s[p],gl)=0 then continue; s[1]:=UpCase(s[1]); s[sered]:=UpCase(s[sered]); s[p]:=UpCase(s[p]); m[i]:=s+'('+s[1]+','+s[sered]+','+s[p]+')'; end; s:=''; for i:=1 to n do s:=s+m[i]+' '; preobr:=s;end;
beginassign(f,'input.txt'); reset(f);assign(t,'output.txt'); rewrite(t); while not eof(f) do begin readln(f,s); writeln(t, preobr(s) ); end; writeln('Файл успешно записан...'); close(f);close(t);readln;end.
[0, 0, "a", 1]
[1, 1, "b", 2]
[1, 2, "bb", 3]
[2, 2, "b", 4]
[0, 3, "abba", 5]
[3, 3, "a", 6]
[3, 4, "aa", 7]
[4, 4, "a", 8]
[3, 5, "aaa", 9]
[4, 5, "aa", 10]
[5, 5, "a", 11]
[3, 6, "", 12]
[4, 6, "aaa", 13]
[5, 6, "aa", 14]
[6, 6, "a", 15]
[2, 7, "bb", 16]
[7, 7, "b", 17]
[6, 8, "aba", 18]
[8, 8, "a", 19]
[7, 9, "bab", 20]
[9, 9, "b", 21]
#код программы Ruby 22
s = "abbbab"
n = 0
for r in 0..s.size-1
for l in 0..r
t = s[l..r]
if t.reverse == t
n += 1
p [l,r,t,n]
end
end
end