|
|
|
Палиндромы
|
|||
|---|---|---|---|
|
#18+
Создать программу, проверяющую является ли строка текстовым палиндромом Вот мой рабочий вариант,НО,мне нужно его не много упростить. Помогите:( uses crt; const rz=['.',',',';',':','?','!','-',' ']; procedure Format(var st:string); var i:byte; begin for i:=length(st)downto 1 do if st[i] in rz then delete(st,i,1); for i:=1 to length(st) do st[i]:=upcase(st[i]); for i:=1 to length(st) do if st[i] in ['а'..'п'] then st[i]:=chr(ord(ord(st[i])-32)) else if st[i] in ['р'..'я'] then st[i]:=chr(ord(ord(st[i])-80)) else if st[i]='ё' then st[i]:='Ё'; end; procedure Palindrom(st:string); var s1:string; i:byte; begin s1:=''; for i:=length(st)downto 1 do s1:=s1+st[i]; if st=s1 then write('palindrom') else write('ne palindrom'); end; var s:string; begin clrscr; writeln('vvedite text:'); readln(s); Format(s); Palindrom(s); readln end. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 22.12.2009, 15:52:06 |
|
||
|
Палиндромы
|
|||
|---|---|---|---|
|
#18+
Код: plaintext 1. 2. 3. 4. 5. 6. 7. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 22.12.2009, 17:02:21 |
|
||
|
Палиндромы
|
|||
|---|---|---|---|
|
#18+
function IsPalindrome(const s: String): Boolean; var i: Integer; t: String; begin Result:=False; if s<>'' then begin t:=LowerCase(s); Result:=True; for i:=1 to Length(t) div 2 do Result:=Result and (t[i]=t[Length(t)-i+1]); end; end; ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 22.12.2009, 17:18:43 |
|
||
|
|

start [/forum/topic.php?fid=16&msg=36380533&tid=1344012]: |
0ms |
get settings: |
11ms |
get forum list: |
15ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
195ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
39ms |
get tp. blocked users: |
1ms |
| others: | 235ms |
| total: | 513ms |

| 0 / 0 |
