# 1/S p X p Theo Tên: CODE (Ch n t t c

)
Program Sap_Xep_Theo_Ten; TYPE ConTro = ^HoSo; HoSo = RECORD HoLot : String[17]; Ten : String[7]; Diem : Real; End; VAR a : Array[1..50] Of HoSo; Tam : ConTro; i,j,PhanTu : Integer; BEGIN PhanTu := 0; New(Tam); With Tam^ Do Repeat Write('-Nhap ho lot ( 0 de ket thu): '); Readln(HoLot); If HoLot <> '0' Then Begin Write('-Nhap ten : '); Readln(Ten); Write('-Nhap diem : '); Readln(Diem); PhanTu := PhanTu + 1; a[PhanTu] := Tam^; End; Until HoLot = '0'; For i := 1 To PhanTu - 1 Do For j := PhanTu DownTo i+1 Do If a[j].Ten[1] < a[j-1].Ten[1] Then Begin Tam^ := a[j]; a[j] := a[j-1]; a[j-1] := Tam^; End; Writeln; Writeln('------------------------------------'); Writeln('| HO VA TEN | DIEM |'); Writeln('|--------------------------|-------|'); For i := 1 To PhanTu Do With a[i] Do Writeln('|',HoLot:17,' ',Ten:7,' |',Diem:5:1,' Writeln('------------------------------------'); Readln END.

|');

2/S p x p i m t ng: CODE (Ch n t t c )
Program Sap_Xep_Diem_Tang;

TYPE ConTro = ^Lop; Lop = RECORD HoTen : String[24]; NamSinh : Integer; DiemTb : Real; End; VAR Hs : Array[1..50] Of lop; i,j,n : Integer; Tam : ConTro; Begin Writeln('SAP XEP DIEM TANG DAN);'); Writeln('Giai thuat noi Buble'); Writeln('--------------------'); New(Tam); Writeln; Write('-So hoc sinh: '); Readln(n); For i := 1 To N Do With Hs[i] Do Begin Write('+Ho ten hoc sinh thu: ',i:2,' la: '); Readln(Hoten); Write('+Nam sinh: '); Readln(NamSinh); Write('+Diem trung binh: '); Readln(DiemTb); End; For i := 1 To N-1 Do For j := 1 To N-i Do If Hs[j].DiemTb > Hs[j+1].DiemTb Then Begin Tam^ := Hs[j]; Hs[j] := Hs[j+1]; Hs[j+1] := Tam^; End; Writeln; Writeln(' DANH SACH SAP XEP'); Writeln; For i := 1 To N Do With Hs[i] Do Writeln('-',HoTen:24,' :',Namsinh:4,' , ',DiemTb:5:2); Readln End.

3/Hóa

n:

CODE (Ch n t t c )
Program Hoa_Don; CONST Max = 100; TYPE ConTro = ^HoaDon; HoaDon = RECORD NguoiMua : String[24];

TenHang : String[10]; DonGia : Real; SoLuong : Integer; End; VAR a : Array[1..Max] Of HoaDon; DsTenHang : Array[1..Max] Of String[10]; Tam : ConTro; Spt, SoTenHang, i, j : Integer; Tong : Real; KiemTra : Boolean; BEGIN Writeln('HOA DON BAN HANG'); Writeln('----------------'); Writeln; Spt := 0; New(Tam); With Tam^ do Repeat Write('-Ten nguoi mua (go 0 de thoat): '); Readln(NguoiMua); If NguoiMua <> '0' Then Begin Write('-Ten hang: '); Readln(TenHang); Write('-Don gia : '); Readln(DonGia); Write('-So luong: '); Readln(SoLuong); Spt := Spt + 1; a[Spt] := Tam^; End; Until NguoiMua = '0'; SoTenHang := 0; For i := 1 To Spt Do Begin KiemTra :=False; For j := 1 To SoTenHang Do If DsTenHang[j] = a[i].TenHang Then KiemTra := True; If NOT KiemTra Then Begin SoTenHang :=SoTenHang + 1; DsTenHang[SoTenHang]:=a[i].TenHang; End; End; Writeln; For i := 1 To SoTenHang Do Begin Tong := 0; For j := 1 To Spt Do With a[j] Do If TenHang = DsTenHang[i] Then Tong := Tong + (DonGia * Soluong); Writeln(' +Tong so tien mua: ',DsTenHang[i]:10,' = ',tong:10:2);

End; Readln END.

4/Th vi n sách: CODE (Ch n t t c )
Program Thu_Vien; Uses Crt; TYPE ConTro = ^ThuVien; ThuVien = RECORD TenSach : String[30]; TacGia : String[24]; Namxb : Byte; NguoiMuon: String[24]; Next : ConTro; End; VAR First,Last,Newp : ConTro; ds,dm : Integer; Ch : Char; HeapTop : ^Integer; BEGIN ClrScr; GotoXY(5,25); Write('Bam <Enter> de tiep tuc, bam <Esc> de thoat'); Window(1,1,80,24); Writeln('QUAN LY THU VIEN'); Writeln('----------------'); Writeln; ds := 0; dm := 0; First := Nil; Mark(Heaptop); Repeat New(Newp); With Newp^ Do Begin Write('-Ten sach : '); Readln(TenSach); If TenSach <> '' Then Begin ds := ds + 1; Write('-Tac Gia: '); Readln(TacGia); Write('-Nam xuat ban : '); Readln(Namxb); Write('-Nguoi muon (Khong co ai muon thi bam <Enter>: '); Readln(NguoiMuon); If NguoiMuon <> '' Then dm := dm + 1; End; End; If First = Nil Then

End.Namxb). Write('Bam <Enter> de tiep tuc. Writeln('+So sach cho muon: '. i. 5/H S Nhân Viên: CODE (Ch n t t c ) Program Ho_So_Nhan_Vien. Tuoi : Integer.TenSach).NguoiMuon). LuongMax. Writeln. HoSo = RECORD HoTen : String[24].Ds). Ch : Char. While First <> Nil Do With First^ Do Begin Writeln('-Ten sach: '.25). Writeln('-Tac gia : '.LuongTb : LongInt.TacGia). Readln END. Write(' Bam <Esc> de thoat').2. Writeln('HO SO NHAN VIEN').Next := Nil. bam <Esc> de thoat '). Writeln('----------------'). GoToXY(5. Writeln('---------------'). Writeln('-Nguoi muon : '. Uses Crt. Writeln. ClrScr. Hoten2 : String[24].TuoiMin : Integer. TYPE ConTro = ^HoSo.TuoiMax. LuongMin. . Next : ConTro. Ch := ReadKey.Dm). Writeln.80. Until Ch = #27. Last.First := Newp Else Last^. Luong : LongInt. Hoten1. Writeln('QUAN LY THU VIEN').25). HeapTop :^Integer. Last :=Newp. Release(HeapTop). Begin ClrScr. Newp : ConTro. Window(1. End. Writeln('-Nam Xuat ban: '. First := Next. VAR First.Next := Newp. Last^. Writeln('+Tong so sach: '.

Until Ch = #27. LuongMax := Luong. End Else If Luong < LuongMin Then Begin LuongMin := Luong.Next := Newp. HoTen2 := HoTen.LuongMax:10). Write('-Tuoi = '). i := 0. Writeln('Nhan vien co tuoi nho nhat la:'.' . TuoiMax := Tuoi. End. New(Newp).co bac luong lon nhat: '. With Newp^ Do Begin Write('-Ho ten nhan vien thu: '. If Luong > LuongMax Then Begin LuongMax := Luong. TuoiMin := Tuoi. Last := Newp.First :=Nil. Write('-Bac luong = '). Writeln('Nhan vien co tuoi lon nhat la: '. Repeat i := i + 1. HoTen1 := HoTen. Writeln('Nhan vien: '.TuoiMax).' la= '). .i:2. Release(HeapTop). Ch := ReadKey. End. First := Next.' .LuongMin:10). Writeln('+Nhan vien: '. Readln(Luong). Readln(HoTen). While First <> Nil Do With First^ Do Begin If Tuoi > TuoiMax Then TuoiMax := Tuoi Else If Tuoi < TuoiMin Then TuoiMin := Tuoi.TuoiMin). HoTen2 := HoTen. Writeln.HoTen1. HoTen1 := HoTen. Readln(Tuoi).Next := Nil. Last^. If First = Nil Then First := Newp Else Last^. Writeln. Mark(HeapTop).co bac luong nho nhat: '. End.HoTen2. LuongMin := Luong.

Tam : ConTro. NamSinh : Integer. End.i:2. Write(' Bam <Enter> de ket thuc ')..' la: '). VAR Hs : Array[1. Hs[j+1] := Tam^. New(Tam).n. Write(' +Diem trung binh hoc ky 2: '). End.50] Of lop. Lop = RECORD HoTen : String[24]. Writeln('Giai thuat noi Buble'). Write('-So hoc sinh: ').Writeln. 6/Tính i m x p h ng: CODE (Ch n t t c ) Program Tinh_Diem_Xep_Hang. Write(' +Nam sinh: '). Readln(NamSinh).Hang: Integer. Writeln. Readln(Tb2). i. For i := 1 To N Do With Hs[i] Do Begin Write(' +Ho ten hoc sinh thu: '. Readln(Tb1). For i := 1 To N Do Begin . Readln End.j. Writeln('--------------------'). Writeln. Write(' +Diem trung binh hoc ky 1: '). Readln(n).Tb < Hs[j+1]. Writeln. Writeln(' DANH SACH XEP HANG'). Begin Writeln('TINH DIEM VA XEP HANG). Writeln.Tb2. Hs[j] := Hs[j+1]. Readln(Hoten).Tb : Real. TYPE ConTro = ^Lop. For i := 1 To N-1 Do For j := 1 To N-i Do If Hs[j].').Tb Then Begin Tam^ := Hs[j]. Hang := 1. End. Tb :=(Tb1 + Tb2)/2. Tb1.

Writeln. Writeln('HOAN VI 2 CON TRO THAY CHO HOAN VI NOI DUNG'). Writeln('-Chuoi thu hai : '.Chuoi1^).Hang). Writeln. Writeln. Writeln(' . End. 8/Tách danh sách ch n l : CODE (Ch n t t c ) Program Tach_Danh_Sach_Chan_Le. '). Readln End. Writeln. TYPE Mang = Array[1..Hs[i]. Writeln('-------------------------------------------'). Write(' Bam <Enter> . End. 7/Hoán v chu i: CODE (Ch n t t c ) Program Hoan_Vi_Chuoi. Writeln(' .0'.Tb:5:2).Diem trung binh ca nam : '. Begin ClrScr. Writeln('-Chuoi thu nhat: '. New(Chuoi1).Chuoi2^). .Hoc sinh : '. Tam := Chuoi1. Writeln('----------------------------------'). Chuoi2^ := 'Giao trinh FoxPro 2.Chuoi1^). VAR Chuoi1.HoTen).Tam :^String. Writeln.Chuoi2. Chuoi1 := Chuoi2.Hs[i]. Dispose(Chuoi1).Chuoi2^). Uses Crt. Writeln('NOI DUNG SAU KHI HOAN VI 2 CON TRO'). Writeln('----------------------------'). Writeln(' . Dispose(Chuoi2). Writeln. .NamSinh). Writeln('-Chuoi thu nhat: '.6'.Nam sinh : '.If (i > 1) And (Hs[i]. Readln.100] Of Integer.Tb <> Hs[i-1].Xep hang ca nam : '. . Chuoi2 := Tam. Uses Crt.Hs[i]. Writeln('-Chuoi thu hai : '.Tb) Then Hang := i. Writeln('NOI DUNG BAN DAU CUA 2 CHUOI'). Chuoi1^ := 'Giao trinh Turbo Pascal 7. New(Chuoi2). Writeln(' .

End. Next : ConTro. For i := 1 To j-1 Do Write(b[i].k. Writeln('TACH THANH 2 DANH SACH'). ').j. Write('-So phan tu: '). Writeln. 9/ o ng c danh sách: CODE (Ch n t t c ) Program Dao_Nguoc_Danh_Sach. Uses Crt.' '). Writeln('----------------------'). . Writeln.b. Readln(n).i:2. k := 1. For i := 1 To n Do If Odd(a[i]) Then Begin b[j] := a[i]. End. Writeln(' NHAP DANH SACH'). Writeln. Writeln. TYPE ConTro = ^Nut. Begin ClrScr.VAR i. j := j + 1.' '). Readln(a[i]).n : Integer. Nut = RECORD So : Integer. End. Readln End. Writeln(' --------------'). Writeln(' -Danh sach thu hai ( so chan ) '). Writeln. . Writeln. End Else Begin c[k] :=a[i]. For i := 1 To n Do Begin Write('-Phan tu thu: '. Write(' Bam <Enter> . Writeln. k := k + 1. j := 1. a.' = ').c : Mang. Writeln. For i := 1 To k-1 Do Write(c[i]. . Writeln(' -Danh sach thu nhat ( so le ) ').

Tam1 := Tam1^. Ch : Char. Write('-Nhap so: ').Cuoi2 : ConTro. End. . Tam1^. Tam : ConTro. Ch : Char.Cuoi1 : ConTro. While Tam1 <> Nil Do Begin Write(Tam1^.Next. . BEGIN ClrScr. Uses Crt.Tam1. Repeat Tam2 := Tam1^. Readln END. Dau2. Readln(Ch). Until Tam1 = Nil.VAR Nut1. Write(' Nhap nua khong ? (c/k) '). Nut1 := Nil. Nut = RECORD Kt : Char. '). Writeln. 10/Ghép Chu i: CODE (Ch n t t c ) Program Ghep_Chuoi.So:6).So). Writeln('Sau khi dao: '). Nut1 := Tam1. Writeln(' DAO NGUOC DANH SACH'). Nut1 := Tam1. Repeat New(Tam1).Tam2 : ConTro. Next : ConTro. TYPE ConTro = ^Nut.Next := Nut1. Writeln(' -------------------'). .Next. VAR Dau1.Next := Nut1. Tam1 := Tam2. Write(' Bam <Enter> . Tam1^. BEGIN ClrScr. Readln(Tam1^. Until UpCase(Ch)= 'K'. End. i : Integer. Tam1 := Nut1. Tam1 := Nut1. Nut1 := Nil.

Kt).Next := Tam. While Tam <> Nil Do Begin Write(Tam^. Writeln('--------------'). ClrScr. Cuoi1^. Repeat i := i + 1. Writeln(' KET QUA'). Readln(Ch). End. End Else Begin Cuoi1^. Writeln.Next. Writeln. End. Readln(Tam^. End. Writeln. Writeln('---------'). Write('-Ky tu thu: '. Repeat i := i + 1.Kt). Writeln.Next :=Nil. Writeln('--------------'). Cuoi1 := Tam. Tam := Tam^.Kt). .' : '). Cuoi1 := Tam. Cuoi2 := Tam. Readln(Tam^.Next := Dau2. Until UpCase(Ch) = 'K'. i := 0. If i = 1 Then Begin Dau1 := Tam. Cuoi2^. Tam := Dau1. Until UpCase(Ch) = 'K'.i:2. End Else Begin Cuoi2^. If i = 1 Then Begin Dau2 := Tam. New(Tam).i:2. Write('Nhap nua khong ? (c/k) '). Writeln('CHUOI THU HAI'). Write('Nhap nua khong ? (c/k) ').' : '). Write('-Ky tu thu: '.Writeln('CHUOI THU NHAT'). Readln(Ch).Next := Tam. Cuoi2 := Tam. New(Tam). i := 0.

. End. Trai := Nil. Var P.Phai : ConTro.Luong. Trai := Nil.HoTen. P1 := Nil. .Luong. .Write(' Readln END. ').HoTen. End Else Begin P := Goc. With Goc^ Do Begin HoTen := NV. While P <> Nil Do Begin P1 := P. Uses Crt. Luong : Real. TYPE Str = String[24]. With P^ Do Begin HoTen := NV.Phai. Bam <Enter> . Ch : Char. Luong := NV. VAR Goc : ConTro. End.HoTen Then P := P^. Nv : BanGhi). New(P). Nv : BanGhi.P1 : ConTro. ConTro = ^BanGhi. Ketthuc : Boolean. Trai. If Nv. End.Trai Else P := P^. Phai := Nil. {--------------------------------} Procedure Chen(Var Goc : ConTro.HoTen <= P^. Luong := NV. BanGhi = RECORD HoTen : Str. 11/Cây nh phân (hay): CODE (Ch n t t c ) Program Cay_Nhi_Phan. Begin If goc = Nil Then Begin New(Goc).

Nhanh :(NhanhTrai. Q1 := Nil.Trai := P Else P1^. End.Trai. Q^. Nv : BanGhi). While (P <> Nil) And (P^. End. Nhanh := NhanhTrai.Phai := P.Phai Else Begin Q := P^.Phai. Var P.Trai.HoTen) Do Begin P1 := P.HoTen Then P1^. Q := Q^. Begin If Goc = Nil Then Writeln('Cay rong') Else Begin P := Goc. If Q1 <> Nil Then Begin Q1^.Trai := P^.Q1 : ConTro. Nhanh := NhanhPhai.HoTen Then Begin P := P^. P1 := Nil.Trai. If NV. If P1 = Nil Then Goc := Q Else Begin .Phai <> Nil Do Begin Q1 := Q.HoTen < P^. End.Phai := Nil.Q. End.Trai. End Else Begin P := P^. If Nv. End.NhanhPhai). While Q^. If P = Nil Then Writeln('Khong tim thay') Else Begin If (P^. {--------------------------------} Procedure Xoa(Var Goc : ConTro.Phai.HoTen <> Nv. End.Phai := Q^.Trai = Nil) Then Q := P^. End.HoTen <=P1^.P1.

Writeln('3-Xoa khoi cay').Phai := Q.HoTen < P^.Trai <> Nil Then LNRLietKe(Goc^. End Else Begin If Goc^. '.'. Writeln('4-Tim kiem tren cay'). {--------------------------------} Procedure Tim(Goc : ConTro. Writeln('--------------------------'). {--------------------------------} BEGIN Repeat ClrScr.Goc^. Writeln. End. Nv : BanGhi). chua co du lieu'). Dispose(P).HoTen) Do If NV.HoTen Then P := P^. Writeln(Goc^. End. P^. Begin P := Goc.If Nhanh = NhanhTrai Then P1^. Writeln('1-Khoi tao cay').Trai Else P := P^. Var P : ConTro. If Goc^.Phai <> Nil Then LNRLietKe(Goc^. Writeln('2-Noi them vao cay').Luong:8:1).Phai).HoTen. Begin If Goc = Nil Then Begin Writeln('Cay rong. Writeln. End. End. {--------------------------------} Procedure LNRLietKe(Goc : ConTro). Writeln('CAC CHUC NANG CAY NHI PHAN').HoTen <> Nv.' '.Trai := Q Else P1^. If P = Nil Then Writeln('Khong tim thay') Else Begin Writeln('Tim thay').Trai).Phai.Luong:8:1). End.HoTen. . End. While (P <> Nil) And (P^. Writeln(P^. Writeln('5-Liet ke danh sach'). End. End. End.

'2' : Begin ClrScr. Writeln. Writeln. KetThuc := False.Nv). End. Readln(HoTen). End. Writeln('3. '3' : Begin ClrScr. Until ketThuc. Readln(Luong). If HoTen <> '' Then Begin Write('-Bac luong : '). End Else KetThuc := True. Writeln('2-NOI VAO CAY THEO THU TU'). Until ketThuc. If HoTen <> '' Then Begin Write('-Bac luong : '). Chen(Goc. Case Ch Of '1' : Begin ClrScr. Writeln. End Else KetThuc := True. Readln(HoTen).Nv). Readln(Luong). Readln(Ch). Repeat With Nv Do Begin Write('-Ho ten hoac <Enter> de ngung: '). . End. Writeln('1-KHOI TAO CAY'). Writeln. Write('Chon cac chuc nang tu 1 den 6: ').XOA KHOI CAY'). Repeat With Nv Do Begin Write('-Ho ten hoac <Enter> de ngung: ').Writeln('6-Ket thuc chuong trinh'). Goc := Nil. Writeln('Cay co thu tu LNR'). Writeln. KetThuc := False. Chen(Goc. End. Writeln('-----------------'). Writeln('-------------------------').

Writeln. '6' : Begin Writeln('7KET THUC CHUONG TRINH'). End. Writeln('---------------------------'). Writeln. End. '). ketThuc := False. Repeat With Nv Do Begin Write('Ho ten can xoa. Until KetThuc. Writeln('5LIET KE NOI DUNG CAY'). . End.'). Repeat With Nv Do Begin Write('Ho ten can tim. If HoTen <> '' Then Xoa(Goc. KetThuc := False.. '5' : Begin ClrScr. '4' : Begin ClrScr. End. Writeln('4TIM KIEM TREN CAY'). Readln(HoTen). If HoTen <> '' Then Tim(Goc. hoac <Enter> de ngung: '). Readln End. . Writeln. hoac <Enter> de ngung: '). Writeln('Hien thi theo thu tu ABC. . End.NV) Else KetThuc := True. Writeln. Write('Xem xong bam <Enter> .. Until Ch = '6' END. Readln(HoTen). Until KetThuc. Writeln('-------------------').Writeln('--------------').NV) Else KetThuc := True. Writeln. End. LNRLietKe(Goc).

He2). Write('-Nhap so nguyen he thap phan: '). Var i. Writeln. Readln End.N).' ma ASCII = '. 14/Trung bình c ng: CODE (Ch n t t c ) Program Tb_cong. Writeln('+Doi sang he 2 la: '.Ch. Writeln. He2:=Tam + He2.12/ i th p phân ra nh phân: CODE (Ch n t t c ) Program Doi_thap_phan_ra_nhi_phan. Writeln. Readln End.tong:Integer. Writeln('Bam phim <Enter> de ket thuc'). 13/M ng kí t : CODE (Ch n t t c ) Program Mang_Ky_Tu. Begin Writeln('IN MA ASCII CUA CAC KY TU'). End. Var He10. He2:=' '.Y:Word. Writeln(' -----------------').dem.Tam:String. Writeln(' Bam phim <Enter> de ket thuc'). He2.N. Writeln('-Ky tu: '. . Str(Y. For Ch:='A' To 'Z' Do Begin a[Ch]:=Ord(Ch). Until He10 = 0. Ch:Char. Repeat Y:=He10 Mod 2. Begin Writeln('DOI SO TU HE THAP PHAN SANG HE NHI PHAN'). N:=He10. Writeln. Var a:Array[Char] Of Integer. Writeln('------------------------'). He10:= He10 Div 2. Writeln('+So he 10 la : '. Readln(He10). Tam).so.a[ch]).

Writeln('----------------------------------'). End.. Writeln. Writeln('+Trung binh cong cua: '. Writeln. Write('-Can che so: '). a[dem]:=so. Readln(so). While so > 0 Do Begin dem:=dem+1. Write('-Vao vi tri: '). Tong:=0.vitri:Integer.. Readln(a[i]).dem:2. Begin Writeln('TINH TRUNG BINH CONG CAC SO NGUYEN').i. Readln(spt). a:Array[1. A:Array[1.100] Of Integer. Writeln('--------------------'). Readln(vitri).100] Of Integer.Tb:Real. Write('-Co bao nhieu phan tu: '). Writeln('MANG TRUOC KHI CHEN'). Writeln.' so vua nhap = '. Tb:=Tong/dem. Readln(so). dem:=0. Readln(so). For i:=1 To spt Do Begin Write('-Phan tu A['. For i:=1 to dem Do Tong:=Tong+A[i]. Var i. Begin Writeln('CHEN MOT SO VAO MANG'). For i:=spt+1 Downto Vitri+1 Do a[i]:=a[i-1]. Writeln. 15/Chèn m t s vào hàng: CODE (Ch n t t c ) Program Chen.spt:Integer. so. Writeln.Tb:8:2). For i:=1 To spt Do Write(a[i]:6). Write('-Nhap so nguyn: '). Write('-Nhap so nguyen (-1 de ngung): '). End.']= '). Writeln(' Bam phim <Enter> de ket thuc '). . Readln End.

Writeln. spt:=spt . Writeln. Writeln. 16/Xóa ph n t trong m ng: CODE (Ch n t t c ) Program Xoa_Pt. For i:=1 To spt Do Write(a[i]:6). Readln(vitri). Begin Writeln('XOA PHAN TU TRONG MANG').i:2. Writeln. Writeln(' ----------------'). For i:=1 To spt Do Begin Write('-Phan tu A['. Readln(spt). Writeln. For i:= 1 to spt Do Write(a[i]:6).']= '). For i:=vitri to spt . Writeln('MANG SAU KHI CHEN'). Writeln.1. Writeln. Writeln(' MANG SAU KHI XOA'). Write('-Vi tri muon xoa: '). 17/Th ng kê các s l : CODE (Ch n t t c ) . a:Array[1.spt. Writeln('----------------------').100] Of Integer.a[vitri]:=so.. Writeln. End. Readln(a[i]). Writeln. For i:=1 To spt Do Write(a[i]:6).vitri:Integer. Readln End. Writeln(' -----------------'). Writeln(' MANG TRUOC KHI XOA'). Write('-Mang co bo nhieu phan tu: '). Writeln(' Bam phim <Enter> de ket thuc '). Writeln. Readln End. spt:=spt+ 1. Var i.1 Do a[i]:=a[i+1].

Writeln('------------------------------'). Var a:Array[1. 18/Tính giá tr c a a th c b c N: CODE (Ch n t t c ) Program Da_thuc. End. Begin Writeln('THONG KE CAC SO LE'). Writeln('+Tri cua da thuc P(x)= '. Write('-Cho biet bac cua da thuc: '). Writeln. For i:= 1 To spt Do Write(a[i]:6).i:2. Writeln. Writeln(' Bam phim <Enter> de ket thuc '). For i:= N Downto 0 Do Begin Write('-Cho biet he so A['. sole:=0.p:Real. For i:= N Downto 1 Do P:=x * p + a[i-1].']= ').sole:Byte.sole)..spt. Readln End.']= '). Begin Writeln('TINH GIA TRI CUA DA THUC BAC N'). i. Writeln. Readln(a[i]).255] Of Real. Writeln('-Tong so cac so le la: '.spt). Writeln. Readln(a[i]).P:0:6). Writeln. Readln(spt). Writeln. . i.Program So_le.255] Of Integer. Readln(x). P:=a[n]. For i:=1 To spt Do If Odd(A[i]) Then Inc(sole).i:2..n:Byte. Write('-Cho biet X= '). Write('-Can nhap bao nhieu so: '). Var a:Array[1. Writeln('------------------'). x. Writeln('-Tong so cac so da nhap: '. End. For i:=1 To spt Do Begin Write('-Phan tu A['. Readln(n).

20/ i s nguyên ki u Word ra h nh phân: CODE (Ch n t t c ) Program Doi_he_2. Bam phim <Enter> de ket thuc ').SoHex).. 19/ i s nguyên ki u Word ra h th p l c: CODE (Ch n t t c ) Program Doi_he_16. SoHex[3]:= KyTuHe16[Lo(SoWord) SHR 4]. Write('-Nhap so kieu Word: '). Write('-Nhap so kieu Word: ').soWord). Writeln. Writeln('+So nguyen kieu Word = '.Writeln. Writeln('+Doi ra so he thap luc = \$'.1] Of Char ='01'. SoBinary[0]:=#16. Begin Writeln('DOI SO NGUYEN KIEU WORD RA HE THAP LUC').soWord). Writeln. Writeln(' Bam phim <Enter> de ket thuc '). . Readln(SoWord). Const KyTuHe16:array[0. SoHex:String[4].. Begin Writeln('DOI SO NGUYEN KIEU WORD RA HE NHI PHAN'). i:byte. Writeln('--------------------------------------'). Readln(SoWord). Writeln('--------------------------------------'). Var SoWord:Word. SoHex[2]:= KyTuHe16[Hi(SoWord) AND \$F]. Writeln('+So nguyen kieu Word = '. SoHex[4]:= KyTuHe16[Lo(SoWord) AND \$F]. SoHex[1]:= KyTuHe16[Hi(SoWord) SHR 4]. Readln End. For i:=15 DownTo 0 Do If (SoWord AND (1 SHL i)) = (1 SHL i) Then SoBinary[16-i]:= KyTuHe2[1] Else SoBinary[16-i]:= KyTuHe2[0].\$F] Of Char ='0123456789ABCDEF'. SoHex[0]:=#4. Writeln(' Readln End. Const KyTuHe2:array[0. Writeln. SoBinary:String[16]. Var SoWord:Word.

Writeln('CONG 2 SO NGUYEN'). For k:=spt Downto spt-nmax Do . Readln(b[nb]). For k:=0 To na-1 Do a[spt-k]:=a[na-k].b.. na:=na-1.' = ').nb. Write('-Chu so thu: '. 21/C ng 2 s nguyên: CODE (Ch n t t c ) Program Cong_so. Writeln('+SO THU HAI (-1 de ket thuc) '). nb:=nb-1. Writeln.nmax. If na>nb Then nmax:=na Else nmax:=nb. k.SoBinary). Until a[na]=-1. tam:=0. nb:=0. Writeln('+SO THU NHAT (-1 de ket thuc) '). Write('-Chu so thu: '. Readln(a[na]). ClrScr.na.na.' = '). Writeln('----------------'). Var a. Repeat na:=na+1. Begin ClrScr. Readln End.nb.tam:Integer. For k:=1 to spt-na Do a[k]:=0. Type mang=Array[1. na:=0. Uses Crt.spt] Of Integer. Writeln(' Bam phim <Enter> de ket thuc '). Until b[nb]=-1.Writeln('+Doi ra so he nhi phan= B '. Const spt=301. For k:=0 To nb-1 Do b[spt-k]:=b[nb-k]. Repeat nb:=nb+1.kq:Mang. For k:=1 to spt-nb Do b[k]:=0. Writeln.

Writeln. Type mang=Array[1.k.c. Var b:mang). Writeln('KET QUA CONG 2 SO NGUYEN'). Writeln(' Bam phim <Enter> de ket thuc '). Var tam1. Write('*So thu nhat: ').kq:Mang. Write('*Tong = ').k:Integer. 22/Nhân 2 s nguyên: CODE (Ch n t t c ) Program Nhan_so.tam:Integer. Write('*So thu hai : ').na. Begin na:=0. tam:=(a[k]+b[k]+tam) Div 10.spt] Of Integer.' ').na.Begin kq[k]:=(a[k]+b[k]+tam) Mod 10. Var k:Integer.nb. i. . Write('-Chu so thu: '. For k:=0 To na-1 Do a[spt-k]:=a[na-k].' = ').' '). {---------------------------} Procedure Nhap(Var a:mang.tam2. Until a[na]=-1. For k:=spt-na+1 To spt Do Write(a[k]. For k:=Spt-nmax To spt Do Write(kq[k]. Writeln('------------------------').j. Repeat na:=na+1. For k:=1 to spt-na Do a[k]:=0.b. na:=na-1. Var a. Readln(a[na]). Writeln. Var na:Integer). {---------------------------} Procedure Cong(a:mang. Writeln. Const spt=900. Uses Crt.. End. For k:=spt-nb+1 To spt Do Write(b[k]. End. Readln End. ClrScr.' ').

{---------------------------} BEGIN ClrScr. End. tam1:=tam2. 23/Ma tr n vuông 10x10 ph n t : . Writeln. For k:=spt-na+1 To spt Do Write(a[k]. For k:=spt-nb+1 To spt Do Write(b[k]. Writeln. End. For k:=Spt-(na+nb)+1 To spt Do Write(kq[k]. For k:=1 To spt Do kq[k]:=0.na).' '). Nhap(a. ClrScr. End. Writeln('----------------'). Writeln('+SO THU NHAT (-1 de ket thuc) '). Writeln('-----------------------'). Writeln(' Bam phim <Enter> de ket thuc '). Cong(c. tam:=(b[j]*a[i]+tam) Div 10. Write('*Tich = '). Readln END. Writeln. Writeln. Write('*So thu hai : '). For j:=spt Downto spt-nb Do Begin For k:=1 to spt Do c[k]:=0. For i:=spt Downto spt-na Do Begin c[j+i-spt]:=(b[j]*a[i]+tam) Mod 10. Writeln('NHAN 2 SO NGUYEN').Begin tam1:=0. tam:=0. ClrScr. Writeln('KET QUA NHAN 2 SO NGUYEN'). Writeln. Writeln('+SO THU HAI (-1 de ket thuc) '). b[k]:=(a[k]+b[k]+tam1) Mod 10.' ').kq) End.' '). Write('*So thu nhat: '). For k:= spt Downto 1 Do Begin tam2:=(a[k]+b[k]+tam1) Div 10. Nhap(b.nb).

5. Var a:Array[1. Write(a[i. i.6] Of Integer.so. Write('-So muon tim: '). ClrScr.j]:=0.60. Writeln. Readln(a[i. . End. Var a:Array[1. Begin Writeln('TIM MOT SO TRONG MANG').']= ').CODE (Ch n t t c ) Program Ma_tran_vuong. Writeln('-----------------------------'). End.j.10] Of Integer. Writeln.j:Integer. i. Uses Crt. Writeln(#10) End.. 24/Tìm m t s trong m ng: CODE (Ch n t t c ) Program Tim_so.i.' tai hang: '.j] Then Begin solan:=solan+1. Readln(so). Writeln('+Lan: '.j).i. 1. Writeln.4. Begin Writeln('MA TRAN VUONG 10 x 10 PHAN TU').' cot: '.j]). solan:=0. For i:=1 To 4 Do For j:=1 To 6 Do If so=a[i.. Writeln('---------------------').solan.j. Readln End. For i:=1 To 4 Do For j:=1 to 6 Do Begin Write('-Phan tu A['.10.'.'. Writeln(' Bam phim <Enter> de ket thuc '). For i:= 1 To 10 Do Begin For j:=1 To 10 Do Begin If i=j Then a[i.1.25). Window(10..j]:5)..j]:=i Else a[i. End.solan:Integer.

2]-a[1. i. y:=Dty / Dt.#7.y).2. 1. Writeln('X= '.1]*a[2.Writeln. .i. Writeln. {Dt: Dinh thuc} Dtx:=c[1]*a[2.1]. End. Writeln('--------------------------').'Vo nghiem').#7. End Else Begin If (Dtx=0) And (Dty=0) Then Writeln(#7. Var A:Array[1. 25/Gi i h phu ng trình tuy n tính 2 n: CODE (Ch n t t c ) Program Giai_he_PT_tuyen_tinh. Writeln('+Tong so lan xuat hien la: '.2]*c[1].2]-c[2]*a[2. {Giai he phuong trinh} Dt:= a[1.. Dty:=a[1.']= '). Writeln. If Dt <> 0 Then Begin x:=Dtx / Dt. C:Array[1.x).1]. Writeln('Y= '.dty:Real.j:Integer. Readln(c[i]).'. Readln(a[i.dt...solan). Readln End.j. End. End. Writeln. Writeln('-Nhap cac he so A cua he phuong trinh: ').'. Begin Writeln('GIAI HE PT TUYEN TINH 2 AN'). For i:=1 To 4 Do Begin For j:=1 To 6 Do Write(a[i. Writeln('-Nhap cac he so C cua he phuong trinh: ').2] Of Real.' Co vo so nghiem') Else Writeln(#7.i.1]*c[2]-a[1.2] Of Real.j]:8).y.']= '). Writeln. x.#7.j]). For i:=1 to 2 Do For j:=1 To 2 Do Begin Write('+Phan tu A['.#7. For i:=1 to 2 Do Begin Write('+Phan tu C['.2]*a[2.dtx.

For i:=1 To m Do For j:=1 To n Do Begin Write('+Phan tu B['.B. For i:=1 To Hang1 Do For j:=1 To n Do Begin c[i.i.j]). Write('-So cot = '). Writeln.cot1.Max] Of Integer. End.'. Hang1:=m.j].q:Integer. Writeln. End. Const Max=10.Max. Writeln('------------'). Cot1:=m. Write('-So cot = ').i. Readln(n). Readln(b[i. Readln(m). Readln(a[i.m.j.j]:=0. Type Matran=Array[1.i.n. For i:=1 To m Do For j:=1 To n Do Begin Write('+Phan tu A['.C:Matran.j. Writeln('MA TRAN B:').1. Var A. Readln(n).'. hang1.'. Bam phim <Enter> de ket thuc ').j] + a[i. Write('-So hang = ').'. End..j]:= c[i. Readln(m). Writeln. For q:=1 To Cot1 Do c[i. Writeln('MA TRAN A:').j]). Write('-So hang = ').' = '). Writeln(' Readln End.' = ').q] * b[q.. For i:=1 to hang1 Do Begin For j:= 1 To n Do . Begin Writeln('NHAN MA TRAN').End.j. 26/Nhân ma tr n: CODE (Ch n t t c ) Program Nhan_ma_tran.

l1:=Length(St).St1.l1:2. Begin Writeln('TIM VA XOA CAC KY TU TRUNG NHAU TRONG CHUOI'). Writeln(' Bam phim <Enter> de ket thuc').1). St1:=St.i. Writeln(' Sau khi xoa ky tu trung nhau'). If UpCase(Ch)='C' Then Begin Delete(St.l.' ky tu'). Readln End. i:=1.i:2. 28/Tìm chu i 2 xu t hi n trong chu i 1: CODE (Ch n t t c ) Program Tim_chuoi. Ch:Char. l:=Length(St).l:2. .' bi trung lap'). End. Readln(St).1. Var St. If St[i]=St[i . Writeln('+Chuoi ban dau : '.' co: '.St2:String. Write('-Nhap mot chuoi: '). Write('Ban co muon xoa ky tu nay khong (c/k)'). i.1] Then Begin Writeln('+Ky tu thu: '.St1:String.' gom: '. End.' la: '.j]):8). Writeln. Writeln.St. Writeln.' ky tu'). Writeln(' Chuoi con lai: '.Write((c[i. While i <= l Do Begin i:=i+1. End. Var St1.St[i]. 27/Tìm và xóa các kí t trùng nhau trong chu i: CODE (Ch n t t c ) Program Tim_Xoa.l1:Byte. Writeln(' -----------------'). Writeln. End. Readln(Ch). Readln End. i:= i .

i:=i-2. Var St:String. i:=i-1.sl:Integer. Writeln. i:=Length(St). Readln(St).i. Readln(St2). Writeln(' --------------'). For i:=1 To Length(St1) Do If St2 = Copy(St1. Label l1. End. End.Length(St2)) Then sl:=sl+1. Writeln. 'V':If (i > 1) And (St[i-1] = 'I') Then Begin So:=So+4. Writeln('+Chuoi thu 2 xuat hien: '. Writeln. . Writeln(' Bam phim <Enter> de ket thuc'). Write('-Chuoi thu nhat: '). Write('-Chuoi thu hai : '). i. sl:=0.sl:2. 29/ i s La mã ra s th p phân: CODE (Ch n t t c ) Program So_La_Ma. End Else Begin So:=So+5. 'X':If (i > 1) And (St[i-1] = 'I') Then Begin So:=So+9. Readln End. So:=0.So:Integer.i. Writeln(' ------------'). i:=i-1. While i > 0 Do Case St[i] Of 'I':Begin So:=So+1. L1:Write('-Nhap so La ma: '). tiep:Char. Begin Writeln('TIM CHUOI HAI XUAT HIEN TRONG CHUOI MOT'). Begin Writeln('DOI SO LA MA RA SO THAP PHAN'). Readln(St1). Writeln.' lan trong chuoi 1').

= 'X') Then = 'X') Then = 'C') Then = 'C') Then End. i:=i-1. End. i:=i-2. End.i:=i-2. 'L':If (i > 1) And (St[i-1] Begin So:=So+40. End. i:=i-2. End Else Begin So:=So+500. 'C':If (i > 1) And (St[i-1] Begin So:=So+90. End Else Begin So:=So+50. i:=i-2. i:=i-1. i:=i-1. End. . End. i:=i-1. End. Writeln('+Doi ra thap phan: '. End Else Begin So:=So+10. i:=i-1. Readln(tiep). 'M':If (i > 1) And (St[i-1] Begin So:=So+900.So). End Else Begin So:=So+1000. Writeln('+So La ma : '. Write('-Tiep tuc nua khong (c/k) '). End Else Begin So:=So+100.St). Writeln. i:=i-2. If UpCase(tiep)='C' Then Goto l1. 'D':If (i > 1) And (St[i-1] Begin So:=So+400.

Val(St.n:Integer. St[i]:=Chr(n). Readln(k). Readln(St). . Until Dung = 0. For i:= 1 To Length(St) Do Begin n:=Ord(St[i]). xin nhap lai:'). k:Integer. End.So. Writeln(' -----------'). If n > 122 Then n:=(n Mod 122) + 96. k:=k Mod 26. Var St:String. tt:Write('-Nhap mot so: '). 31/Chu ng trình mã hóa: CODE (Ch n t t c ) Program Ma_hoa. If UpCase(Tiep)='C' Then Goto tt. Label tt. Writeln. Readln(Tiep). Begin Repeat Writeln('KIEM TRA SO NHAP VAO'). Write('-Nhap ma so k: '). tiep:Char. Dung:Integer. If (n >=97) And (n<=122) then Begin n:=n+k. i.30/Ki m tra s nh p vào: CODE (Ch n t t c ) Program Kiem_tra_so.So:8:2) Else Writeln(' +Khong phai so. If Dung = 0 Then Writeln(' +Ban da nhap mot so: '. Write('-Nhap chuoi: '). Begin Writeln('CHUONG TRINH MA HOA'). Writeln(' -----------').Dung). Readln(St). End. Var St:String. So:Real. Write('-Co tiep tuc khong (C/K) ').

Var St1. Readln(St2). Write('-Nhap chuoi 1: '). Writeln. Var St:String. Delete(St.1. i:Integer. Writeln(' --------------').St2:String. Writeln. Repeat While (St[1] =' ') And (Length(St) <> 0) Do Delete(St. Dung:=False.1). For i:= 1 To Length(St1) Do If Pos(St1[i]. Writeln. If Length(St1)=Length(St2) Then Begin Dung:=True.1). Write('-Nhap chuoi 2: '). Until Length(St)=0. Readln(St1). Begin Writeln('NGAT TUNG TU TRONG CAU'). Readln End. Readln End. End. Writeln. 33/Ki m tra kí t trùng c a 2 chu i: CODE (Ch n t t c ) Program Cung_Ky_Tu. 32/Ng t t ng t trong câu: CODE (Ch n t t c ) Program Ngat_tu.1. Writeln(' --------------'). Writeln('+Sau khi ma hoa: '. Dung:Boolean. Writeln.St2) = 0 Then .St). Readln(St). Write('-Nhap mot cau: ').End. Begin Writeln('KIEM TRA KY TU TRUNG CUA 2 CHUOI'). Writeln(' Bam phim <Enter> de ket thuc'). While (St[1] <> ' ') And (Length(St) <>0) Do Begin Write(St[1]).

St:String. Write('-Nhap so nguyen: '). l. So1:=So. For i:=1 To (so Div 1000) Do St:=St+'M'.i:Integer. Begin Writeln('KIEM TRA CHUOI DOI XUNG'). Dung:Boolean.So1.1). Write('-Nhap chuoi: ').Pos(St1[i]. For i:=1 To (l Div 2) Do If St[i] <> St[l-i+1] Then Dung:=False. Readln End. Var So. 35/ i s th p phân ra s la mã: CODE (Ch n t t c ) Program So_La_Ma. St:=' '. Readln(St).i:Integer. Writeln(' -------------'). 34/Ki m tra chu i CODE (Ch n t t c ) i x ng: Program Chuoi_Doi_Xung. Begin Writeln('DOI SO THAP PHAN SANG SO LA MA'). Readln End. Writeln. l:=Length(St). Readln(So). Writeln. Dung:=True. Var St:String. If Dung Then Writeln('+Chuoi nay doi xung') Else Writeln('+Chuoi nay khong doi xung'). So:=So Mod 1000. End. If Dung Then Writeln('+Hai chuoi co cung cac ky tu') Else Writeln('+Hai chuoi co cac ky tu khac nhau').St2). Writeln(' ------------').Dung:=False Else Delete(St2. .

So:=So-90. If So >= 9 Then Begin St:=St+'IX'. So:=So-500. If So >= 90 Then Begin St:=St+'XC'. So:=So Mod 10. End. End Else If So >=4 Then Begin St:=St+'IV'. So:=So-50. So:=So-9. So:=So Mod 100. End Else If So >=400 Then Begin St:=St+'CD'. So:=So-900. End Else If So >=5 Then Begin St:=St+'V'. . End Else If So >=50 Then Begin St:=St+'L'. End. So:=So-40. End Else If So >=500 Then Begin St:=St+'I'. For i:=1 To (so Div 100) Do St:=St+'C'. So:=So-400. End Else If So >=40 Then Begin St:=St+'XL'. So:=So-4. For i:=1 To (so Div 10) Do St:=St+'X'. So:=So-5.If So >= 900 Then Begin St:=St+'CM'. End.

Max] Of Real. Writeln('----------------------------------'). Writeln('IN THEO THU TU NGUOC'). Var i. Writeln. Writeln. Writeln('+So thap phan: '. Repeat Write('-Cho biet so phan tu: '). 36/Mãng s th c: CODE (Ch n t t c ) Program Mang_so_thuc. Writeln('--------------------'). Writeln. For i:=N Downto 1 Do Write(a[i]:4:1. For i:=1 To N Do Begin Write('+Phan tu thu: '. Writeln. Uses Crt..n:Integer. A:mang. Begin Writeln('MANG SO THUC'). Writeln('+So La ma : '. Writeln.i.St). Readln End. Type Mang=Array[1. 37/T ng tích ma tr n: CODE (Ch n t t c ) Program Tong_Tich_Ma_tran. End. Writeln. . Writeln. For i:=1 To N Do Write(a[i]:4:1. Until N <= Max. Writeln.' '). Readln(a[i]). Writeln(' Bam phim <Enter> de ket thuc'). Writeln('------------').So1).' = '). Readln(N).For i:=1 To So Do St:=St+'I'. Writeln('IN CAC DOI SO CUA CAC PHAN TU MANG').' '). Readln End. Const Max = 100.

m[i.'['.j. . GotoXY(26.']= ').k:Byte.j]+b[i.Type Matran=array[1.j]). GotoXY(26. Ten:Char). Xuat(c.'.'B'). End.k]*b[k.10+2*j).j]). End.'.'C'). For i:=1 To 3 Do For j:=1 to 3 Do Begin GotoXY(20*i-8. Begin ClrScr. Write(Ten.. Var a.j]:=a[i. Repeat Ch:=Readkey. If Ch=#0 then Ch:=Readkey. End.Ten).j].j.3] Of Integer.6).'A').1. Write(Ten. For k:=1 To 3 Do d[i.Ten). i. End. Ch:Char. {*****************************} BEGIN Nhap(a. Nhap(b. Writeln. Writeln('MA TRAN TONG'). Begin ClrScr. Ten:Char).'. Write('-Nhap ma tran: '.6). Readln(m[i.j]:=a[i.10+2*j)..b.3.d:Matran. GotoXY(10.j].'['. Write('CAC PHAN TU CUA MA TRAN: '. {*****************************} Procedure Xuat(m:Matran. End.i. For i:=1 To 3 Do For j:=1 To 3 Do c[i.i. {*****************************} Procedure Nhap(Var m:Matran.j]+d[i. For i:=1 to 3 Do For j:=1 To 3 Do Begin d[i. For i:=1 To 3 Do For j:=1 To 3 Do Begin GotoXY(20*i-8. Writeln.c.'.j]:=0. Write('Bam phim <Esc> de xem ma tran tich').']= '.25).

Begin Writeln('SAP XEP MANG BANG GIAI THUAT CHEN'). For i:=1 to Max-1 Do For j:= i+1 To Max Do Begin If a[i] > a[j] Then Begin tam:=a[i]. a[i]:=a[j].j.k.spt] Of Integer. Const Max=10. . End..tam:Integer.Max] Of Integer. Readln(a[i]).i.']= '). i. Readln End. Writeln. Var a:array[1. For i:=1 To Max Do Write(a[i]. 38/S p x p m ng t ng d n: CODE (Ch n t t c ) Program Mang_tang. End. Begin Writeln('SAP XEP MANG TANG DAN'). a[j]:=tam. Repeat Until KeyPressed.' '). End.Until Ch=#27.j. 39/S p x p m ng b ng gi i thu t chèn: CODE (Ch n t t c ) Program Gt_Chen.'D'). Writeln. Xuat(d. Writeln('+Mang sau khi sap xep:'). END. Writeln('---------------------'). Var a:Array[1. Writeln. Writeln.. For i:= 1 To Max Do Begin Write('-Phan tu A['. Const spt=10.tam:Integer. i. Writeln('MA TRAN TICH= ').

vitri. For i:=2 To spt Do If a[i] < a[i-1] Then Begin j:=1. Readln(a[i]).']= '). End. vitri:=j. min. a[vitri]:=a[i].i. For k:=i Downto j+1 Do a[k]:=a[k-1].i. Readln End. For i:=1 To spt Do Write(a[i]:6). Writeln(' Bam phim <Enter> de ket thuc '). For i:=1 To spt Do Begin min:=a[spt].j:Integer. For i:=1 To spt Do Begin Write('-Phan tu A['. Begin Writeln('SAP XEP MANG BANG GIAI THUAT CHON'). Writeln. . End. Readln(a[i]). Writeln. For i:=1 To spt Do Begin Write('-Phan tu A['. For j:=i To spt Do If a[j] < min Then Begin min:=a[j].Writeln('---------------------------------'). Var a:array[1. End. a[j]:=tam. Writeln.spt] Of Integer.i. Writeln('---------------------------------'). Const spt=10.']= '). Writeln. While a[j] < a[i] Do j:=j+1.. vitri:=spt. End. Writeln('Mang sau khi sap xep:'). tam:=a[i]. 40/S p x p m ng b ng gi i thu t ch n: CODE (Ch n t t c ) Program Gt_Chon.

Writeln('-----------------------------------'). Var a:array[1.']= ').i. Readln End. Writeln(' Bam phim <Enter> de ket thuc '). 41/S p x p m ng b ng gi i thu t n i b t: CODE (Ch n t t c ) Program Gt_Noi_bot. 42/Gi i thu t tìm ki m tuy n tính: CODE (Ch n t t c ) Program Tim_Tuyen_Tinh. Readln(a[i]).a[i]:=min. Const N=10. Var . Writeln('Mang sau khi sap xep:'). End. Writeln. For i:=1 To spt-1 Do For j:= spt Downto i+1 Do If a[j] < a[j-1] Then Begin tam:=a[j]. Writeln('Mang sau khi sap xep:').spt] Of Integer. a[j]:=a[j-1]. Readln End. End. End. i.j. Begin Writeln('SAP XEP MANG BANG GIAI THUAT NOI BOT'). Writeln. a[j-1]:=tam. Writeln. For i:=1 To spt Do Write(a[i]:6). Const spt=10. For i:=1 To spt Do Write(a[i]:6). Writeln.. Writeln. Writeln(' Bam phim <Enter> de ket thuc ').tam:Integer. For i:=1 To spt Do Begin Write('-Phan tu A['.

Begin Writeln('GIAI THUAT TIM KIEM TUYEN TINH'). vt2:=n. vt1:=1. Writeln('----------------------------').i. i:=1. Writeln('------------------------------'). For i:=1 To N Do Begin Write('-Phan tu A['. While (i <=N) And (a[i] <> so) Do i:=i+1.. Writeln(' Bam phim <Enter> de ket thuc '). Begin Writeln('GIAI THUAT TIM KIEM NHI PHAN').a:array[1. Const N=10. Writeln.i) Else Writeln('+Khong tim thay'). Readln(so). Readln End.i.']= '). Write('-So can tim: '). If so > a[i] Then vt1:=i+1 Else If so < a[i] Then .N] Of Integer.i:Integer. For i:=1 To N Do Begin Write('-Phan tu A['. Write('-So can tim: ').i:Integer. Writeln. Writeln. End. While vt2 >= vt1 Do Begin i:=Trunc((vt1+vt2) Div 2).N] Of Integer.. 43/Gi i thu t tìm ki m nh phân: CODE (Ch n t t c ) Program Tim_Nhi_Phan. Readln(a[i]). End. so. Readln(so). Var a:array[1.']= ').vt1. so. Writeln.vt2. If i <= N Then Writeln('+Tim thay o vi tri thu: '. Readln(a[i]). Writeln.

. Const Max=100..j. Readln(n). For i:=1 To N Do Begin Write('-Phan tu A['. End.k. While a[j] <> a[i] Do j:=j+1. While i <= N Do Begin j:=1. Readln End. Writeln(' Bam phim <Enter> de ket thuc '). i:=2. End.i. Write('-Nhap so phan tu mang: '). If vt2 = -1 Then Writeln('+Tim thay o vi tri thu: '. Writeln.Max] Of Integer. Write('-Mang con lai: '). i. Readln(a[i]). For i:=1 to n Do Write(a[i]:8). Writeln(' Bam phim <Enter> de ket thuc '). n:=n-1.n:Integer. Writeln. Writeln('------------------------'). Var a:Array[1. Readln End.']= '). End Else i:=i+1. End. Writeln. 44/Xóa b các s trùng nhau: CODE (Ch n t t c ) Program Bo_so_trung. Writeln.i) Else Writeln('+Khong tim thay').vt2:=i-1 Else vt2:=-1. If j < i Then Begin For k:=i to n-1 Do a[k]:= a[k+1]. Begin Writeln('XOA BO CAC SO TRUNG NHAU').

k] Of Integer=(1. i:=i+1.45/Dãy con: CODE (Ch n t t c ) Program Day_con.7. Writeln('-Day con la: ').max:Integer.6. Until max=0. Writeln. max:=a[1].29. n:=i. tong:=a[i]. vt.12.'mac dinh chi'). Readln End. End. End.10] Of String[24]=('nguyen trung truc'. Uses Crt.3.. Var i:Integer. vt:=n. Const a:Array[1.3).'chu van an'. 'nguyen hue'.j:Byte. For i:=2 To k Do Begin If (a[i] > a[i-1]) Then tong:=tong+a[i]. 'nguyen cong tru'. Begin Vt:=1.tong:Integer.10. Var k. Repeat Write(a[i]:6).'le loi'. n. 46/Ch hoa: CODE (Ch n t t c ) Program Chu_hoa.'tran hung dao'. tong:=a[1].'le lai'. End.8. Const k=10. i:=vt. If (a[i] < a[i-1]) Or (i=k) Then Begin If tong > max Then Begin max:=tong. Writeln(' Bam phim <Enter> de ket thuc '). n:=1. a:Array[1.'dinh tien hoang'. {-------------------------} . max:=max-a[i].2..'le thanh ton'.

Var a:Array[1.j]:=a[i-1. Var k:Byte.. Writeln(' Bam phim <Enter> de ket thuc ').a[k]) End. i.n. Readln End. For i:=1 To n Do Begin For j:=1 To i Do Write(a[i.j]:=0.n] Of Integer. Begin For k:=1 To length(a) Do If (k=1) Or ((a[k-1]=' ') And (a[k]<>' ')) Then Begin GotoXY(x+k-1. . For i:=1 To n Do a[i. Writeln('---------------'). Writeln(' Bam phim <Enter> de ket thuc ').y). End. Writeln.. Writeln. Const n=10. End. ChuHoa(5. Write(UpCase(a[k])).j]:4). For k:=1 To 10 Do Begin GotoXY(5.j]. a:String). Readln End.1]:=1.j-1]+a[i-1. Begin ClrScr.k). Write(a[k]:-24).Procedure ChuHoa(x. 47/Tam giác Pascal: CODE (Ch n t t c ) Program Tg_Pascal. For i:=2 To n Do For j:=2 To n Do a[i.j:Integer. Writeln. For j:=1 To n Do a[1. 1.y:Byte. Writeln.k. Begin Writeln('TAM GIAC PASCAL'). End.

. Begin Writeln('PHAN TICH SO NGUYEN DUONG NHO NHAT').10] Of Byte.j]. Writeln. For i:=1 To 5 Do For j:=1 To 10 Do Begin GotoXY(cot. For i:=1 To n Do For j:=1 To i Do Begin For i1:= i+1 To n Do For j1:=1 To j-1 Do If a[i.hang).j1:Integer. Writeln('----------').i. For i:=1 To n Do For j:=1 To n Do a[i... End. 1.5.' + '.j:Byte. Writeln. Writeln.' ^3').j]:=i * j.j]:=i*i*i + j*j*j. Const n=15. i.j1] Then Writeln(a[i. a[i.n. Var a:Array[1. hang:=3. Writeln('IN KET QUA').j]=a[i1.48/Phân tích s nguyên du ng nh nh t: CODE (Ch n t t c ) Program Phan_tich. Writeln('----------------------------------'). Type cc1=Array[1.' ^3 '. Begin cot:=1. .' = '.' + '. Readln End. i1.' ^3 '. cc2=Array[6.10] Of Byte.j. 1.n] Of Longint. Writeln(' Bam phim <Enter> de ket thuc ')..' ^3 '. cot. 49/B ng c u chu ng: CODE (Ch n t t c ) Program Cuu_Chuong. Var i.j1.i1. Uses Crt.j..hang:Byte. Procedure In1.' = '. 1.10.. Var a:cc1.

. -------------------------------------------'). Bam phim <Enter> de ket thuc').' ='.' lan '. 50/Tìm 2 ph n t liên ti p trong b ng X: CODE (Ch n t t c ) Program Tim_PT_Mang. Textcolor(Cyan). Var a:Array[1.j:2. End. For i:=6 To 10 Do For j:=1 To 10 Do Begin GotoXY(cot. hang:=hang+1.j]:=i * j. End. If hang > 12 Then Begin hang:=3. Writeln(i:2. Writeln(i:2. End. cot:=cot+15.'|'). Writeln(' Writeln(' In1. Textcolor(LightBlue). BEGIN ClrScr. {----------------------------} Procedure Tao. Writeln(' In2.TextColor(Yellow). Writeln(' Readln END. End. cot. BANG CUU CHUONG'). Var a:cc2. a[i. hang:=14.hang:Byte. Textcolor(LightGreen). Textcolor(LightMagenta). End.'|'). Procedure In2. ---------------').a[i.j]:3.hang). .j]:3. End.' ='. hang:=hang+1.j:2. Begin cot:=1. cot:=cot+15. Uses Crt.a[i.1000] Of Integer.' lan '. If hang > 23 Then Begin hang:=14.

Var k. Writeln.CH NG III Th Vi n Các D ng Bài T p Pascal c a Tin H c 11 . Readln. End. End. For k:=1 To 999 Do Begin If a[k] +a[k+1] = X Then Writeln('a['.While ±. .Ph n 2 [Bài T p Pascal Hay] C U TRÚC D LI U KI U M NG .X) Else Writeln('Khong co 2 phan tu nao bang: '.CH NG II [Bài T p Pascal] XÂU KÝ T (STRING) . {----------------------------} Procedure Tim. Begin Write('-Nhap gia tri X= ').K+1.X).x:Integer.Ph n 1 [Bài T p Pascal Hay] C U TRÚC D LI U KI U FILE . Writeln. END.Var k:Integer. Begin Randomize.']= '. Khách vi ng th m ã y y y y y y y y y y c qua nh ng bài này cùng chuyên m c ch a?: Các Bài T p Pascal l p 11 . Writeln(' Bam phim <Enter> de ket thuc '). Tim..Có áp Án Các Bài T p Pascal l p 11 . Tao. Writeln('-------------------------------------').Có áp Án [Bài T p Pascal Hay] D LI U KI U T P .. End.K. Readln(x).Có áp Án [Bài T p Pascal Hay] VÒNG L P XÁC NH VÀ KHÔNG XÁC NH (For .CH NG I Th Vi n Các D ng Bài T p Pascal c a Tin H c 11 . For k:=1 To 100 Do a[k]:=Random(100).'] + a['. BEGIN Writeln('TIM 2 PHAN TU LIEN TIEP BANG GIA TRI X').Có áp Án Các Bài T p Pascal l p 11 .

Sign up to vote on this title