Houssey
Moderator
 Din: Buzau
Inregistrat: acum 18 ani
Postari: 260
|
|
{v21. Fie un vector de litere mici. Sortati-l alfabetic.} var a:array[1..27] of char; i,n:integer; t:char; s:boolean; begin repeat write('nr de litere al vectorului=');readln(n); until (n>0) and (n<27); i:=1; repeat begin write('a[',i,']=');readln(a[i]); end; if (a[i]<='z') and (a[i]>='a') then i:=i+1; until i>n; repeat s:=true; for i:=1 to n-1 do if a[i]>a[i+1] then begin t:=a[i]; a[i]:=a[i+1]; a[i+1]:=t; s:=false; end; until s; for i:=1 to n do begin writeln(a[i]); end; readln;readln; end.
_______________________________________ House Music Set`s Me Free!
|
|