PASCAL程式設計問題

2021-03-11 11:21:27 字數 3008 閱讀 6959

1樓:匿名使用者

因為機器上沒有安裝pascal,所以用delphi的控制檯來實現。62616964757a686964616fe78988e69d8331333330346531

2樓:

var i, j : longint;

r, s, t : string;

temp : char;

begin

readln(r);

readln(s);

t := s;

for i := 1 to length(r) do

begin

if r[i] = 'a' then

begin

for j := 1 to length(s) div 2 do

begin

temp := s[j];

s[j] := s[length(s) - j + 1];

s[length(s) - j + 1] := temp;

end;

end;

if r[i] = 'c' then

begin

for j := length(s) downto 1 do

s[j+1] := s[j];

s[1] := t[length(t)];

end;

if r[i] = 'e' then

begin

for j := 1 to length(s) div 2 do

s[j] := t[j + (length(t) + 1) div 2];

for j := length(s) div 2 + 1 to length(s) do

s[j] := t[j - (length(t) + 1) div 2];

if length(s) mod 2 = 1 then

s[length(s) div 2 + 1] := t[length(t) div 2 + 1];

end;

if r[i] = 'j' then

begin

for j := 1 to length(s) do

s[j] := s[j+1];

s[length(s)] := t[1];

end;

if r[i] = 'm' then

begin

for j := 1 to length(s) do

if ord(s[j]) in [49..57] then

s[j] := chr(ord(s[j]) - 1)

else

if ord(s[j]) = 48 then

s[j] := chr(57);

end;

if r[i] = 'p' then

begin

for j := 1 to length(s) do

if ord(s[j]) in [48..56] then

s[j] := chr(ord(s[j]) + 1)

else

if ord(s[j]) = 57 then

s[j] := chr(48);

end;

end;

writeln(s);

end.

3樓:匿名使用者

vars,t,s1:string;

n,i,j,w,z,w1,z1,w2,z2:longint;

begin

readln(t);

readln(s);

n:=length(s);

for i:=length(t) downto 1 docase t[i] of

'a':begin

for j:=1 to n do

s1:=s1+s[n-j+1];

s:=s1;

s1:='';

end;

'c':begin

for j:=2 to n do

s1:=s1+s[j];

s1:=s1+s[1];

s:=s1;

s1:='';

end;

'e':begin

w:=1;

z:=n div 2;

if n mod 2=0 then beginw1:=z;

z1:=0;

endelse begin

w1:=z+1;

z1:=w1;

end;

w2:=w1+1;

z2:=n;

for j:=w2 to z2 do

s1:=s1+s[j];

for j:=w1 to z1 do

s1:=s1+s[j];

for j:=w to z do

s1:=s1+s[j];

s:=s1;

s1:='';

end;

'j':begin

s1:=s[n];

for j:=1 to n-1 do

s1:=s1+s[j];

s:=s1;

s1:='';

end;

'm':begin

for j:=1 to n do

if s[j] in ['0'..'9']then if s[j]<>'9' then s1:=s1+chr(ord(s[j])+1)

else s1:=s1+'0'

else s1:=s1+s[j];

s:=s1;

s1:='';

end;

'p':begin

for j:=1 to n do

if s[j] in ['0'..'9']then if s[j]<>'0' then s1:=s1+chr(ord(s[j])-1)

else s1:=s1+'9'

else s1:=s1+s[j];

s:=s1;

s1:='';

end;

end;

write(s);

end.

pascal程式設計

var a array 1.100 of byte n,i,j,k,i1 byte begin readln n for i 1 to 13 do a i i i 1 j 13 for k 1 to n 1 do begin inc i for i1 1 to k do begin inc j a ...

pascal簡單問題,pascal簡單問題一個。!

1.program aaa const eps 1e 7 varx,t,s real n integer begin read x n 1 t x s x repeat n n 2 t t x x n 1 n s s t until abs t writeln s end.2.program bbb...

pascal問題 5,pascal問題

pascal問題 它是下標變數,a是陣列名,i是下標。如要真正了解,需學習陣列型別。陣列的第i個元素 如 var a array 1.5 of integer begina 1 3 a 2 4 a 3 8 a 4 6 a 5 5 write a 3 end.就會輸出陣列a中的第3個元素8 陣列中的第...