Program sort_name_tel_yr; uses wincrt; Var name, tel, yr:array[1..10] of string; i,n_name, n_tel, n_yr,flag1, flag2, flag3, pass1, pass2, pass3:integer; temp1, temp2, temp3:string; Begin name[1]:='Robin Gibb'; tel[1]:='25624204'; yr[1]:='1991'; name[2]:='John Lennon'; tel[2]:='98403362'; yr[1]:='1984'; name[3]:='Tom Cruise'; tel[3]:='93120593'; yr[3]:='1996'; name[4]:='Barbara Stryson'; tel[4]:='91289736'; yr[4]:='2000'; name[5]:='Mary Hopkins'; tel[5]:='29604958'; yr[5]:='1993'; Writeln('The name list before sorting : '); n_name:=5; For i:=1 to n_name do writeln(name[i]); For pass1:=1 to n_name - 1 do begin flag1:=0; For i:=1 to n_name - pass1 do begin If name[i]>name[i+1] then begin temp1:=name[i+1]; name[i+1]:=name[i]; name[i]:=temp1; flag1:=1 end; If i=n_name - pass1 then begin If flag1=0 then begin writeln; Writeln('The name list in ascending order'); For i:=1 to 5 do writeln(name[i]) end; end; end; end; Begin Writeln('The telphone number list before sorting : '); n_tel:=5; For i:=1 to n_tel do writeln(tel[i]); For pass2:=1 to n_tel - 1 do begin flag2:=0; For i:=1 to n_tel - pass2 do begin If tel[i]>tel[i+1] then begin temp2:=tel[i+1]; tel[i+1]:=tel[i]; tel[i]:=temp2; flag2:=1 end; If i=n_tel - pass2 then begin If flag2=0 then begin writeln; Writeln('The telephone number list in ascending order'); For i:=1 to 5 do writeln(tel[i]) end; end; end; end; Begin Writeln('The graduate year list before sorting : '); n_yr:=5; For i:=1 to n_yr do writeln(yr[i]); For pass3:=1 to n_yr - 1 do begin flag3:=0; For i:=1 to n_yr - pass3 do begin If yr[i]>yr[i+1] then begin temp3:=yr[i+1]; yr[i+1]:=yr[i]; yr[i]:=temp3; flag3:=1 end; If i=n_yr - pass3 then begin If flag3=0 then begin writeln; Writeln('The graduate year list in ascending order'); For i:=1 to 5 do writeln(yr[i]) end; end; end; end end.